diff --git a/minmax/test/Jamfile.v2 b/minmax/test/Jamfile.v2 index 24ae612..fcfba8a 100644 --- a/minmax/test/Jamfile.v2 +++ b/minmax/test/Jamfile.v2 @@ -9,11 +9,16 @@ import testing ; +alias unit_test_framework + : # sources + /boost//unit_test_framework + ; + { test-suite algorithm/minmax: - : [ run minmax_element_test.cpp + : [ run minmax_element_test.cpp unit_test_framework : : : : minmax_element ] - [ run minmax_test.cpp + [ run minmax_test.cpp unit_test_framework : : : : minmax ] ; } diff --git a/minmax/test/minmax_element_test.cpp b/minmax/test/minmax_element_test.cpp index 8758f12..b8c02f5 100644 --- a/minmax/test/minmax_element_test.cpp +++ b/minmax/test/minmax_element_test.cpp @@ -15,9 +15,11 @@ #include /* prevents some nasty warns in MSVC */ #include -#include #include +#define BOOST_TEST_MAIN +#include + class custom { int m_x; friend bool operator<(custom const& x, custom const& y); @@ -225,17 +227,14 @@ void test(int n BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Value)) test_range(first, last, n); } -int test_main( int argc, char* argv[] ) +BOOST_AUTO_TEST_CASE( test_main ) { #ifndef BOOST_NO_STDC_NAMESPACE using std::atoi; #endif int n = 100; - if (argc > 1) n = atoi(argv[1]); test(n); test(n); - - return 0; } diff --git a/minmax/test/minmax_test.cpp b/minmax/test/minmax_test.cpp index a2570e9..151b096 100644 --- a/minmax/test/minmax_test.cpp +++ b/minmax/test/minmax_test.cpp @@ -8,7 +8,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include class custom { int m_x; @@ -76,10 +78,8 @@ void test(BOOST_EXPLICIT_TEMPLATE_TYPE(Value)) BOOST_CHECK_EQUAL( counter, 1); } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test(); // ("builtin"); test(); // ("custom "); - - return 0; } diff --git a/string/test/Jamfile.v2 b/string/test/Jamfile.v2 index 8b38e2c..7f60df7 100644 --- a/string/test/Jamfile.v2 +++ b/string/test/Jamfile.v2 @@ -9,58 +9,63 @@ import testing ; +alias unit_test_framework + : # sources + /boost//unit_test_framework + ; + test-suite algorithm/string : [ run - trim_test.cpp + trim_test.cpp unit_test_framework : : : : trim ] [ run - conv_test.cpp + conv_test.cpp unit_test_framework : : : : conv ] [ run - predicate_test.cpp + predicate_test.cpp unit_test_framework : : : : predicate ] [ run - find_test.cpp + find_test.cpp unit_test_framework : : : : find ] [ run - split_test.cpp + split_test.cpp unit_test_framework : : : : split ] [ run - join_test.cpp + join_test.cpp unit_test_framework : : : : join ] [ run - replace_test.cpp + replace_test.cpp unit_test_framework : : : : replace ] [ run - regex_test.cpp + regex_test.cpp unit_test_framework ../../../regex/build//boost_regex : : : : regex ] [ run - find_format_test.cpp + find_format_test.cpp unit_test_framework : : : : find_format diff --git a/string/test/conv_test.cpp b/string/test/conv_test.cpp index ca3c5ff..c583d3e 100644 --- a/string/test/conv_test.cpp +++ b/string/test/conv_test.cpp @@ -10,7 +10,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -87,9 +88,7 @@ void conv_test() } // test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { conv_test(); - - return 0; } diff --git a/string/test/find_format_test.cpp b/string/test/find_format_test.cpp index 4201e1e..645cdba 100644 --- a/string/test/find_format_test.cpp +++ b/string/test/find_format_test.cpp @@ -12,7 +12,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include @@ -154,10 +155,8 @@ void find_format_all_test() BOOST_CHECK_EQUAL(output, source); } -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { find_format_test(); find_format_all_test(); - - return 0; } diff --git a/string/test/find_test.cpp b/string/test/find_test.cpp index a93c878..85facb0 100644 --- a/string/test/find_test.cpp +++ b/string/test/find_test.cpp @@ -12,7 +12,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -45,7 +46,7 @@ void find_test() // find_first - BOOST_CHECKPOINT( "find_first" ); + BOOST_TEST_CHECKPOINT( "find_first" ); nc_result=find_first( str1, string("abc") ); BOOST_CHECK( @@ -66,7 +67,7 @@ void find_test() BOOST_CHECK(( (ch_result.begin() - pch1 ) == 3) && ( (ch_result.end() - pch1 ) == 6 ) ); // find_last - BOOST_CHECKPOINT( "find_last" ); + BOOST_TEST_CHECKPOINT( "find_last" ); nc_result=find_last( str1, string("abc") ); BOOST_CHECK( @@ -87,7 +88,7 @@ void find_test() BOOST_CHECK(( (ch_result.begin() - pch1 ) == 15) && ( (ch_result.end() - pch1 ) == 18 ) ); // find_nth - BOOST_CHECKPOINT( "find_nth" ); + BOOST_TEST_CHECKPOINT( "find_nth" ); nc_result=find_nth( str1, string("abc"), 1 ); BOOST_CHECK( @@ -125,7 +126,7 @@ void find_test() BOOST_CHECK(( (ch_result.begin() - pch1 ) == 9) && ( (ch_result.end() - pch1 ) == 12 ) ); // find_head - BOOST_CHECKPOINT( "find_head" ); + BOOST_TEST_CHECKPOINT( "find_head" ); nc_result=find_head( str1, 6 ); BOOST_CHECK( @@ -146,7 +147,7 @@ void find_test() BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 0 ) && ( (ch_result.end() - pch1 ) == 6 ) ); // find_tail - BOOST_CHECKPOINT( "find_tail" ); + BOOST_TEST_CHECKPOINT( "find_tail" ); nc_result=find_tail( str1, 6 ); BOOST_CHECK( @@ -168,7 +169,7 @@ void find_test() BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 15 ) && ( (ch_result.end() - pch1 ) == 21 ) ); // find_token - BOOST_CHECKPOINT( "find_token" ); + BOOST_TEST_CHECKPOINT( "find_token" ); nc_result=find_token( str1, is_any_of("abc"), token_compress_on ); BOOST_CHECK( @@ -194,7 +195,7 @@ void find_test() BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 3 ) && ( (ch_result.end() - pch1 ) == 4 ) ); // generic find - BOOST_CHECKPOINT( "generic find" ); + BOOST_TEST_CHECKPOINT( "generic find" ); nc_result=find(str1, first_finder(string("abc"))); BOOST_CHECK( @@ -207,7 +208,7 @@ void find_test() ( (cv_result.end()-str1.begin()) == 6) ); // multi-type comparison test - BOOST_CHECKPOINT( "multi-type" ); + BOOST_TEST_CHECKPOINT( "multi-type" ); nc_vresult=find_first( vec1, string("abc") ); BOOST_CHECK( @@ -220,7 +221,7 @@ void find_test() ( (cv_result.end()-str1.begin()) == 6) ); // overflow test - BOOST_CHECKPOINT( "overflow" ); + BOOST_TEST_CHECKPOINT( "overflow" ); nc_result=find_first( str2, string("abcd") ); BOOST_CHECK( nc_result.begin()==nc_result.end() ); @@ -233,7 +234,7 @@ void find_test() BOOST_CHECK( string( cv_result.begin(), cv_result.end() )== string("abc") ); // Empty string test - BOOST_CHECKPOINT( "empty" ); + BOOST_TEST_CHECKPOINT( "empty" ); nc_result=find_first( str3, string("abcd") ); BOOST_CHECK( nc_result.begin()==nc_result.end() ); @@ -251,7 +252,7 @@ void find_test() BOOST_CHECK( osstr.str()=="abc" ); // Empty string test - BOOST_CHECKPOINT( "overlapping" ); + BOOST_TEST_CHECKPOINT( "overlapping" ); std::string overlap_target("aaaa"); std::vector > overlap_results; @@ -266,9 +267,7 @@ void find_test() } // test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { find_test(); - - return 0; } diff --git a/string/test/join_test.cpp b/string/test/join_test.cpp index 13e3f0a..9c5150b 100644 --- a/string/test/join_test.cpp +++ b/string/test/join_test.cpp @@ -13,7 +13,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -70,10 +71,8 @@ void join_test() BOOST_CHECK( equals(join_if(tokens3, "-", is_not_empty), "") ); } -// test main -int test_main( int, char*[] ) + +BOOST_AUTO_TEST_CASE( test_main ) { join_test(); - - return 0; } diff --git a/string/test/predicate_test.cpp b/string/test/predicate_test.cpp index 05fede3..ba1564e 100644 --- a/string/test/predicate_test.cpp +++ b/string/test/predicate_test.cpp @@ -11,7 +11,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -152,11 +153,8 @@ void classification_test() #undef TEST_CLASS -// test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { predicate_test(); classification_test(); - - return 0; } diff --git a/string/test/regex_test.cpp b/string/test/regex_test.cpp index 2951a4c..f93c1d9 100644 --- a/string/test/regex_test.cpp +++ b/string/test/regex_test.cpp @@ -15,7 +15,8 @@ // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -149,11 +150,9 @@ static void replace_test() BOOST_CHECK( str1==string("123AxXxCa23ca456c321") ); } -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { find_test(); join_test(); replace_test(); - - return 0; } diff --git a/string/test/replace_test.cpp b/string/test/replace_test.cpp index 7264ea9..789d8e4 100644 --- a/string/test/replace_test.cpp +++ b/string/test/replace_test.cpp @@ -16,7 +16,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -56,14 +57,14 @@ void sequence_traits_test() #define C_ , #define TEST_ALGO( Algo, Input, Params, Output ) \ {\ - BOOST_CHECKPOINT( #Algo " - Copy" );\ + BOOST_TEST_CHECKPOINT( #Algo " - Copy" );\ \ string str1(Input);\ \ /* Copy test */ \ BOOST_CHECK( Algo##_copy( str1, Params )==Output );\ \ - BOOST_CHECKPOINT( #Algo " - Iterator" );\ + BOOST_TEST_CHECKPOINT( #Algo " - Iterator" );\ /* Iterator test */\ string strout;\ Algo##_copy( back_inserter(strout), str1, Params );\ @@ -73,15 +74,15 @@ void sequence_traits_test() vector vec1( str1.begin(), str1.end() );\ list list1( str1.begin(), str1.end() );\ \ - BOOST_CHECKPOINT( #Algo " - Inplace(string)" );\ + BOOST_TEST_CHECKPOINT( #Algo " - Inplace(string)" );\ Algo( str1, Params ); \ BOOST_CHECK( equals( str1, Output ) ); \ \ - BOOST_CHECKPOINT( #Algo " - Inplace(vector)" );\ + BOOST_TEST_CHECKPOINT( #Algo " - Inplace(vector)" );\ Algo( vec1, Params ); \ BOOST_CHECK( equals( vec1, Output ) );\ \ - BOOST_CHECKPOINT( #Algo " - Inplace(list)" );\ + BOOST_TEST_CHECKPOINT( #Algo " - Inplace(list)" );\ Algo( list1, Params ); \ BOOST_CHECK( equals( list1, Output ) );\ } @@ -206,7 +207,7 @@ void replace_range_test() { // replace_range { - BOOST_CHECKPOINT( "replace_range" ); + BOOST_TEST_CHECKPOINT( "replace_range" ); string str1("1abc3abc2"); BOOST_CHECK( @@ -231,7 +232,7 @@ void replace_range_test() } // erase_range { - BOOST_CHECKPOINT( "erase_range" ); + BOOST_TEST_CHECKPOINT( "erase_range" ); string str1("1abc3abc2"); BOOST_CHECK( @@ -305,8 +306,7 @@ void dissect_format_test() } -// test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { sequence_traits_test(); replace_first_test(); @@ -318,6 +318,4 @@ int test_main( int, char*[] ) replace_range_test(); collection_comp_test(); dissect_format_test(); - - return 0; } diff --git a/string/test/split_test.cpp b/string/test/split_test.cpp index 740e6d1..1f26141 100644 --- a/string/test/split_test.cpp +++ b/string/test/split_test.cpp @@ -13,10 +13,12 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include +#include #include #include @@ -44,7 +46,7 @@ void iterator_test() const char* pch1="xx-abc--xx-abb"; vector tokens; vector< vector > vtokens; - + // find_all tests find_all( tokens, @@ -179,12 +181,15 @@ void iterator_test() BOOST_CHECK(siter==split_iterator(siter)); BOOST_CHECK(siter==split_iterator()); +#if 0 +// Make sure we work with forward iterators +// See bug #7989 + list l1; + find_iterator::iterator> liter=make_find_iterator(l1, first_finder("xx")); +#endif } -// test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { iterator_test(); - - return 0; } diff --git a/string/test/trim_test.cpp b/string/test/trim_test.cpp index 8dcce28..b254caa 100644 --- a/string/test/trim_test.cpp +++ b/string/test/trim_test.cpp @@ -11,7 +11,8 @@ #include // Include unit test framework -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -193,12 +194,9 @@ void trim_fill_test() BOOST_CHECK( trim_fill_copy_if( string("<>abc<>def<>"), "-", is_any_of( "<<>>" ) )=="abc-def" ); } -// test main -int test_main( int, char*[] ) +BOOST_AUTO_TEST_CASE( test_main ) { trim_test(); trim_all_test(); trim_fill_test(); - - return 0; } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f079d56..0d79154 100755 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -9,51 +9,60 @@ import testing ; +alias unit_test_framework + : # sources + /boost//unit_test_framework + ; + + { test-suite algorithm: # Search tests - : [ run empty_search_test.cpp : : : : empty_search_test ] - [ run search_test1.cpp : : : : search_test1 ] - [ run search_test2.cpp : : : : search_test2 ] - [ run search_test3.cpp : : : : search_test3 ] - [ run search_test4.cpp : : : : search_test4 ] - [ compile-fail search_fail1.cpp : : : : ] - [ compile-fail search_fail2.cpp : : : : ] - [ compile-fail search_fail3.cpp : : : : ] + : [ run empty_search_test.cpp unit_test_framework : : : : empty_search_test ] + [ run search_test1.cpp unit_test_framework : : : : search_test1 ] + [ run search_test2.cpp unit_test_framework : : : : search_test2 ] + [ run search_test3.cpp unit_test_framework : : : : search_test3 ] + [ run search_test4.cpp unit_test_framework : : : : search_test4 ] + [ compile-fail search_fail1.cpp : : : : ] + [ compile-fail search_fail2.cpp : : : : ] + [ compile-fail search_fail3.cpp : : : : ] # Clamp tests - [ run clamp_test.cpp : : : : clamp_test ] + [ run clamp_test.cpp unit_test_framework : : : : clamp_test ] # Cxx11 tests - [ run all_of_test.cpp : : : : all_of_test ] - [ run any_of_test.cpp : : : : any_of_test ] - [ run none_of_test.cpp : : : : none_of_test ] - [ run one_of_test.cpp : : : : one_of_test ] + [ run all_of_test.cpp unit_test_framework : : : : all_of_test ] + [ run any_of_test.cpp unit_test_framework : : : : any_of_test ] + [ run none_of_test.cpp unit_test_framework : : : : none_of_test ] + [ run one_of_test.cpp unit_test_framework : : : : one_of_test ] - [ run ordered_test.cpp : : : : ordered_test ] - [ run find_if_not_test1.cpp : : : : find_if_not_test1 ] - [ run copy_if_test1.cpp : : : : copy_if_test1 ] - [ run copy_n_test1.cpp : : : : copy_n_test1 ] - [ run iota_test1.cpp : : : : iota_test1 ] + [ run ordered_test.cpp unit_test_framework : : : : ordered_test ] + [ run find_if_not_test1.cpp unit_test_framework : : : : find_if_not_test1 ] + [ run copy_if_test1.cpp unit_test_framework : : : : copy_if_test1 ] + [ run copy_n_test1.cpp unit_test_framework : : : : copy_n_test1 ] + [ run iota_test1.cpp unit_test_framework : : : : iota_test1 ] - [ run is_permutation_test1.cpp : : : : is_permutation_test1 ] - [ run partition_point_test1.cpp : : : : partition_point_test1 ] - [ run is_partitioned_test1.cpp : : : : is_partitioned_test1 ] - [ run partition_copy_test1.cpp : : : : partition_copy_test1 ] + [ run is_permutation_test1.cpp unit_test_framework : : : : is_permutation_test1 ] + [ run partition_point_test1.cpp unit_test_framework : : : : partition_point_test1 ] + [ run is_partitioned_test1.cpp unit_test_framework : : : : is_partitioned_test1 ] + [ run partition_copy_test1.cpp unit_test_framework : : : : partition_copy_test1 ] # Hex tests - [ run hex_test1.cpp : : : : hex_test1 ] - [ run hex_test2.cpp : : : : hex_test2 ] - [ run hex_test3.cpp : : : : hex_test3 ] - [ run hex_test4.cpp : : : : hex_test4 ] + [ run hex_test1.cpp unit_test_framework : : : : hex_test1 ] + [ run hex_test2.cpp unit_test_framework : : : : hex_test2 ] + [ run hex_test3.cpp unit_test_framework : : : : hex_test3 ] + [ run hex_test4.cpp unit_test_framework : : : : hex_test4 ] [ compile-fail hex_fail1.cpp ] # Wrapper tests - [ run wrapper_test1.cpp : : : : wrapper_test1 ] + [ run wrapper_test1.cpp unit_test_framework : : : : wrapper_test1 ] # Gather tests - [ run gather_test1.cpp : : : : gather_test1 ] + [ run gather_test1.cpp unit_test_framework : : : : gather_test1 ] [ compile-fail gather_fail1.cpp ] + +# Dummy test + [ run dummy_test.cpp unit_test_framework : : : : dummy_test ] ; } diff --git a/test/all_of_test.cpp b/test/all_of_test.cpp index bf35da1..36918d5 100644 --- a/test/all_of_test.cpp +++ b/test/all_of_test.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -79,8 +81,7 @@ void test_all () } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_all (); - return 0; } diff --git a/test/any_of_test.cpp b/test/any_of_test.cpp index 57f3fb2..a3267c5 100644 --- a/test/any_of_test.cpp +++ b/test/any_of_test.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -98,8 +100,7 @@ void test_any () } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_any (); - return 0; } diff --git a/test/clamp_test.cpp b/test/clamp_test.cpp index 7d336aa..3519659 100755 --- a/test/clamp_test.cpp +++ b/test/clamp_test.cpp @@ -9,7 +9,8 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include namespace ba = boost::algorithm; @@ -205,7 +206,7 @@ void test_int_range () BOOST_CHECK ( std::equal ( b_e(junk), outputs )); } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_ints (); test_floats (); @@ -214,5 +215,4 @@ int test_main( int , char* [] ) test_int_range (); // test_float_range (); // test_custom_range (); - return 0; } diff --git a/test/copy_if_test1.cpp b/test/copy_if_test1.cpp index 1a16729..b237055 100644 --- a/test/copy_if_test1.cpp +++ b/test/copy_if_test1.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -57,12 +59,12 @@ void test_sequence ( Container const &c ) { // Some of the elements v.clear (); ba::copy_if ( c.begin (), c.end (), back_inserter ( v ), is_even ); - BOOST_CHECK ( v.size () == std::count_if ( c.begin (), c.end (), is_even )); + BOOST_CHECK ( v.size () == (size_t) std::count_if ( c.begin (), c.end (), is_even )); BOOST_CHECK ( ba::all_of ( v.begin (), v.end (), is_even )); v.clear (); ba::copy_if ( c, back_inserter ( v ), is_even ); - BOOST_CHECK ( v.size () == std::count_if ( c.begin (), c.end (), is_even )); + BOOST_CHECK ( v.size () == (size_t) std::count_if ( c.begin (), c.end (), is_even )); BOOST_CHECK ( ba::all_of ( v.begin (), v.end (), is_even )); } @@ -80,8 +82,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/copy_n_test1.cpp b/test/copy_n_test1.cpp index 69d8a46..a61c108 100644 --- a/test/copy_n_test1.cpp +++ b/test/copy_n_test1.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -78,8 +80,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/empty_search_test.cpp b/test/empty_search_test.cpp index 941d6f6..22317f1 100755 --- a/test/empty_search_test.cpp +++ b/test/empty_search_test.cpp @@ -13,9 +13,10 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include -int test_main( int argc, char *argv [] ) +BOOST_AUTO_TEST_CASE( test_main ) { const std::string cs; std::string estr; @@ -77,7 +78,4 @@ int test_main( int argc, char *argv [] ) str.begin (), str.end (), estr.begin (), estr.end ()) == str.begin () ); - - (void) argv; (void) argc; - return 0; } diff --git a/test/find_if_not_test1.cpp b/test/find_if_not_test1.cpp index b23285a..1a17d95 100644 --- a/test/find_if_not_test1.cpp +++ b/test/find_if_not_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -83,8 +85,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/gather_fail1.cpp b/test/gather_fail1.cpp index 2c20c8e..2670bd0 100644 --- a/test/gather_fail1.cpp +++ b/test/gather_fail1.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -32,7 +31,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +int main () { test_sequence1 (); return 0; diff --git a/test/gather_test1.cpp b/test/gather_test1.cpp index 1eff308..0e57b6e 100644 --- a/test/gather_test1.cpp +++ b/test/gather_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -132,8 +134,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/hex_fail1.cpp b/test/hex_fail1.cpp index cd17852..bd5ca46 100644 --- a/test/hex_fail1.cpp +++ b/test/hex_fail1.cpp @@ -9,17 +9,17 @@ #include #include -#include #include #include #include // should not compile: vector is not an integral type -int test_main( int , char* [] ) +int main( int , char* [] ) { std::vector v; std::string out; boost::algorithm::unhex ( out, std::back_inserter(v)); + return 0; } diff --git a/test/hex_test1.cpp b/test/hex_test1.cpp index 891afe4..d9f5364 100644 --- a/test/hex_test1.cpp +++ b/test/hex_test1.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -141,7 +143,7 @@ const wchar_t *fromhex_fail_w [] = { }; -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_to_hex ( tohex ); test_from_hex_success ( fromhex ); @@ -150,5 +152,4 @@ int test_main( int , char* [] ) test_to_hex ( tohex_w ); test_from_hex_success ( fromhex_w ); test_from_hex_failure ( fromhex_fail_w ); - return 0; } diff --git a/test/hex_test2.cpp b/test/hex_test2.cpp index 7092154..af5579a 100644 --- a/test/hex_test2.cpp +++ b/test/hex_test2.cpp @@ -11,7 +11,9 @@ Test non-string cases; vector and list #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -129,9 +131,8 @@ void test_from_hex_success () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_to_hex (); test_from_hex_success (); - return 0; } diff --git a/test/hex_test3.cpp b/test/hex_test3.cpp index e9a47a4..64f0ff4 100644 --- a/test/hex_test3.cpp +++ b/test/hex_test3.cpp @@ -11,7 +11,9 @@ Try ostream_iterators #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -113,11 +115,10 @@ const wchar_t *fromhex_w [] = { -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_to_hex ( tohex ); test_to_hex ( tohex_w ); test_from_hex_success ( fromhex ); test_from_hex_success ( fromhex_w ); - return 0; } diff --git a/test/hex_test4.cpp b/test/hex_test4.cpp index 935293c..df6e8d8 100644 --- a/test/hex_test4.cpp +++ b/test/hex_test4.cpp @@ -11,7 +11,9 @@ Try ostream_iterators #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -136,10 +138,8 @@ void test_nonhex_input () { test_nonhex_input4 (); } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_short_input (); test_nonhex_input (); - - return 0; } diff --git a/test/iota_test1.cpp b/test/iota_test1.cpp index 24fd0e3..080d3d7 100644 --- a/test/iota_test1.cpp +++ b/test/iota_test1.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -72,8 +74,7 @@ void test_ints () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_ints (); - return 0; } diff --git a/test/is_partitioned_test1.cpp b/test/is_partitioned_test1.cpp index 429ae7d..835de2d 100644 --- a/test/is_partitioned_test1.cpp +++ b/test/is_partitioned_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -56,8 +58,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/is_permutation_test1.cpp b/test/is_permutation_test1.cpp index f9c3b1b..2ccd06a 100644 --- a/test/is_permutation_test1.cpp +++ b/test/is_permutation_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -42,8 +44,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/none_of_test.cpp b/test/none_of_test.cpp index ab7ded3..fc74945 100644 --- a/test/none_of_test.cpp +++ b/test/none_of_test.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -89,8 +91,7 @@ void test_none() BOOST_CHECK (!ba::none_of ( li.begin(), l_iter, is_ ( 5 ))); } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_none(); - return 0; } diff --git a/test/one_of_test.cpp b/test/one_of_test.cpp index 0b3f5e0..9422881 100644 --- a/test/one_of_test.cpp +++ b/test/one_of_test.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -94,8 +96,7 @@ void test_one () } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_one (); - return 0; } diff --git a/test/ordered_test.cpp b/test/ordered_test.cpp index 8265c5b..dbaf940 100644 --- a/test/ordered_test.cpp +++ b/test/ordered_test.cpp @@ -13,7 +13,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include using namespace boost; @@ -146,9 +148,8 @@ test_increasing_decreasing(void) } -int test_main( int, char * [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_ordered (); test_increasing_decreasing (); - return 0; } diff --git a/test/partition_copy_test1.cpp b/test/partition_copy_test1.cpp index f3d8d2a..c3afb1e 100644 --- a/test/partition_copy_test1.cpp +++ b/test/partition_copy_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -80,8 +82,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/partition_point_test1.cpp b/test/partition_point_test1.cpp index 4306a4a..95f6058 100644 --- a/test/partition_point_test1.cpp +++ b/test/partition_point_test1.cpp @@ -11,7 +11,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -91,8 +93,7 @@ void test_sequence1 () { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_sequence1 (); - return 0; } diff --git a/test/search_fail1.cpp b/test/search_fail1.cpp index 15459a4..2b9f6f7 100644 --- a/test/search_fail1.cpp +++ b/test/search_fail1.cpp @@ -10,7 +10,7 @@ #include #include -int main( int argc, char *argv [] ) +int main( int , char* [] ) { std::vector cv; std::vector iv; @@ -20,7 +20,5 @@ int main( int argc, char *argv [] ) (void) boost::algorithm::boyer_moore_search ( cv.begin (), cv.end (), iv.begin (), iv.end ()); - - (void) argv; (void) argc; return 0; } diff --git a/test/search_fail2.cpp b/test/search_fail2.cpp index 7b90f1b..463d242 100644 --- a/test/search_fail2.cpp +++ b/test/search_fail2.cpp @@ -11,7 +11,7 @@ #include #include -int main( int argc, char *argv [] ) +int main( int , char* [] ) { std::vector cv; std::vector iv; @@ -21,7 +21,5 @@ int main( int argc, char *argv [] ) (void) boost::algorithm::boyer_moore_search ( cv.begin (), cv.end (), iv.begin (), iv.end ()); - - (void) argv; (void) argc; return 0; } diff --git a/test/search_fail3.cpp b/test/search_fail3.cpp index b2f1feb..caf8335 100644 --- a/test/search_fail3.cpp +++ b/test/search_fail3.cpp @@ -10,11 +10,10 @@ #include #include -int main( int argc, char *argv [] ) +int main( int , char* [] ) { // Should fail to compile because the search objects are not default-constructible boost::algorithm::boyer_moore::iterator> bm; - (void) argv; (void) argc; return 0; } diff --git a/test/search_test1.cpp b/test/search_test1.cpp index e33a6ad..7c49a3a 100755 --- a/test/search_test1.cpp +++ b/test/search_test1.cpp @@ -11,7 +11,8 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include #include #include @@ -218,7 +219,7 @@ namespace { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { std::string haystack1 ( "NOW AN FOWE\220ER ANNMAN THE ANPANMANEND" ); std::string needle1 ( "ANPANMAN" ); @@ -268,5 +269,4 @@ int test_main( int , char* [] ) const std::string mikhail_corpus = std::string (8, 'a') + mikhail_pattern; check_one ( mikhail_corpus, mikhail_pattern, 8 ); - return 0; } diff --git a/test/search_test2.cpp b/test/search_test2.cpp index 0b3295f..4631105 100755 --- a/test/search_test2.cpp +++ b/test/search_test2.cpp @@ -11,9 +11,12 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include #include +#include +#include #include #include @@ -122,7 +125,7 @@ namespace { } } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { vec c1 = ReadFromFile ( "search_test_data/0001.corpus" ); vec p1b = ReadFromFile ( "search_test_data/0001b.pat" ); @@ -140,6 +143,4 @@ int test_main( int , char* [] ) check_one ( c1, p1e, c1.size() - p1e.size ()); std::cout << "--- Not found ---" << std::endl; check_one ( c1, p1n, -1 ); // Not found - - return 0; } diff --git a/test/search_test3.cpp b/test/search_test3.cpp index ee57303..ee32f6a 100755 --- a/test/search_test3.cpp +++ b/test/search_test3.cpp @@ -11,9 +11,12 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include #include +#include +#include #include #include #include @@ -122,7 +125,7 @@ namespace { } } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { vec c1 = ReadFromFile ( "search_test_data/0001.corpus" ); vec p1b = ReadFromFile ( "search_test_data/0002b.pat" ); @@ -140,6 +143,4 @@ int test_main( int , char* [] ) check_one ( c1, p1e, c1.size() - p1e.size ()); std::cout << "--- Not found ---" << std::endl; check_one ( c1, p1n, -1 ); // Not found - - return 0; } diff --git a/test/search_test4.cpp b/test/search_test4.cpp index ff82d1c..2b83267 100644 --- a/test/search_test4.cpp +++ b/test/search_test4.cpp @@ -13,9 +13,12 @@ #include #include -#include +#define BOOST_TEST_MAIN +#include #include +#include +#include #include #include #include @@ -93,7 +96,7 @@ namespace { } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { vec c1 = ReadFromFile ( "search_test_data/0001.corpus" ); vec p1b = ReadFromFile ( "search_test_data/0002b.pat" ); @@ -111,6 +114,4 @@ int test_main( int , char* [] ) check_one ( c1, p1e, c1.size() - p1e.size ()); std::cout << "--- Not found ---" << std::endl; check_one ( c1, p1n, -1 ); // Not found - - return 0; } diff --git a/test/wrapper_test1.cpp b/test/wrapper_test1.cpp index 8cf11fa..913d592 100644 --- a/test/wrapper_test1.cpp +++ b/test/wrapper_test1.cpp @@ -9,7 +9,9 @@ #include #include -#include + +#define BOOST_TEST_MAIN +#include #include #include @@ -67,9 +69,8 @@ void test_str () BOOST_CHECK ( ba::find_ptr ( mm, 55 ) == NULL ); } -int test_main( int , char* [] ) +BOOST_AUTO_TEST_CASE( test_main ) { test_int (); test_str (); - return 0; }