Simplify redundant tested variants in functional tests.

Move explicit instantiations from functional tests to "explicit_inst_xxx".
This commit is contained in:
Ion Gaztañaga
2018-09-25 09:08:24 +02:00
parent 59f70078f0
commit fe85038ebe
15 changed files with 312 additions and 619 deletions
+14 -2
View File
@@ -20,8 +20,6 @@
using namespace boost::container;
using namespace boost::container::pmr;
std::size_t allocation_count = 0;
#ifdef BOOST_MSVC
#pragma warning (push)
#pragma warning (disable : 4290)
@@ -39,6 +37,11 @@ std::size_t allocation_count = 0;
#pragma GCC diagnostic ignored "-Wsized-deallocation"
#endif
//ASAN does not support operator new overloading
#ifndef BOOST_CONTAINER_ASAN
std::size_t allocation_count = 0;
void* operator new[](std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
{
++allocation_count;
@@ -51,10 +54,15 @@ void operator delete[](void *p) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
return std::free(p);
}
#endif //BOOST_CONTAINER_ASAN
#ifdef BOOST_MSVC
#pragma warning (pop)
#endif
#define BOOST_CONTAINER_ASAN
#ifndef BOOST_CONTAINER_ASAN
void test_new_delete_resource()
{
//Make sure new_delete_resource calls new[]/delete[]
@@ -73,6 +81,8 @@ void test_new_delete_resource()
BOOST_TEST(memcount == allocation_count);
}
#endif //BOOST_CONTAINER_ASAN
void test_null_memory_resource()
{
//Make sure it throw or returns null
@@ -109,7 +119,9 @@ void test_default_resource()
int main()
{
#ifndef BOOST_CONTAINER_ASAN
test_new_delete_resource();
#endif
test_null_memory_resource();
test_default_resource();
return ::boost::report_errors();