mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 20:37:22 +02:00
Switch swap tests to lightweight_test.
This commit is contained in:
@ -52,7 +52,7 @@ rule test_all
|
||||
for file in $(run_tests)
|
||||
{
|
||||
local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ;
|
||||
all_rules += [ run $(file) ../../../test/build//boost_test_exec_monitor/<link>static : : : : "swap-$(test_name)" ] ;
|
||||
all_rules += [ run $(file) : : : : "swap-$(test_name)" ] ;
|
||||
}
|
||||
|
||||
#ECHO All rules: $(all_rules) ;
|
||||
|
@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@ -36,7 +37,7 @@ namespace std
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
@ -65,5 +66,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), number_of_elements);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,13 +7,14 @@
|
||||
// Tests swapping an array of arrays of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
@ -38,5 +39,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(ptr1[i], static_cast<int>(i + number_of_elements) );
|
||||
BOOST_CHECK_EQUAL(ptr2[i], static_cast<int>(i) );
|
||||
}
|
||||
return 0;
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@ -36,7 +37,7 @@ namespace std
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_class initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
@ -57,5 +58,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,14 +7,15 @@
|
||||
// Tests swapping an array of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 3;
|
||||
const int initial_array1[array_size] = { 1, 2, 3 };
|
||||
@ -31,5 +32,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of swap_test_template<int> objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@ -46,7 +47,7 @@ void swap(swap_test_template<T>& left, swap_test_template<T>& right)
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_template<int> initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
@ -67,5 +68,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -13,8 +13,9 @@
|
||||
// than std::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
@ -23,7 +24,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
@ -39,6 +40,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),3);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,11 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
int object1 = 1;
|
||||
int object2 = 2;
|
||||
@ -18,6 +19,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,2);
|
||||
BOOST_CHECK_EQUAL(object2,1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
@ -23,7 +24,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
@ -40,6 +41,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
// to the boost namespace.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
@ -42,7 +43,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
@ -59,6 +60,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@ -17,7 +18,7 @@ void swap(swap_test_class& left, swap_test_class& right)
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
@ -34,6 +35,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
@ -23,7 +24,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
@ -40,6 +41,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@ -22,7 +23,7 @@ namespace std
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
@ -39,6 +40,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,13 @@
|
||||
// std::bitset<T> does not have its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <bitset>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef std::bitset<8> bitset_type;
|
||||
const bitset_type initial_value1 = 1;
|
||||
@ -28,6 +29,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,13 @@
|
||||
// std::swap overload or template specialization.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <locale>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::time_base::dateorder initial_value1 = std::time_base::dmy;
|
||||
const std::time_base::dateorder initial_value2 = std::time_base::mdy;
|
||||
@ -27,6 +28,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,13 @@
|
||||
// std::string has its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <string>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::string initial_value1 = "one";
|
||||
const std::string initial_value2 = "two";
|
||||
@ -26,6 +27,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,13 @@
|
||||
// for std::type_info pointers.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::type_info * const initial_value1 = 0;
|
||||
const std::type_info * const initial_value2 = &typeid(double);
|
||||
@ -27,6 +28,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(ptr1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(ptr2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@
|
||||
// having boost::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -28,7 +29,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef boost::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
@ -55,6 +56,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@
|
||||
// having ::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -22,7 +23,7 @@ void swap(swap_test_class& left, swap_test_class& right)
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef std::vector<swap_test_class> vector_type;
|
||||
|
||||
@ -48,6 +49,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@
|
||||
// having other::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -28,7 +29,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef other::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
@ -55,6 +56,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user