Updated Boost.Algorithm tests to use non-deprecated test framework

[SVN r82785]
This commit is contained in:
Marshall Clow
2013-02-08 17:21:43 +00:00
parent 4ca6b10441
commit f65d36aca7
44 changed files with 228 additions and 203 deletions

View File

@ -9,11 +9,16 @@
import testing ; import testing ;
alias unit_test_framework
: # sources
/boost//unit_test_framework
;
{ {
test-suite algorithm/minmax: test-suite algorithm/minmax:
: [ run minmax_element_test.cpp : [ run minmax_element_test.cpp unit_test_framework
: : : : minmax_element ] : : : : minmax_element ]
[ run minmax_test.cpp [ run minmax_test.cpp unit_test_framework
: : : : minmax ] : : : : minmax ]
; ;
} }

View File

@ -15,9 +15,11 @@
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */ #include <boost/config.hpp> /* prevents some nasty warns in MSVC */
#include <boost/algorithm/minmax_element.hpp> #include <boost/algorithm/minmax_element.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#include <boost/iterator/reverse_iterator.hpp> #include <boost/iterator/reverse_iterator.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
class custom { class custom {
int m_x; int m_x;
friend bool operator<(custom const& x, custom const& y); 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); test_range(first, last, n);
} }
int test_main( int argc, char* argv[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
#ifndef BOOST_NO_STDC_NAMESPACE #ifndef BOOST_NO_STDC_NAMESPACE
using std::atoi; using std::atoi;
#endif #endif
int n = 100; int n = 100;
if (argc > 1) n = atoi(argv[1]);
test<int>(n); test<int>(n);
test<custom>(n); test<custom>(n);
return 0;
} }

View File

@ -8,7 +8,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/minmax.hpp> #include <boost/algorithm/minmax.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
class custom { class custom {
int m_x; int m_x;
@ -76,10 +78,8 @@ void test(BOOST_EXPLICIT_TEMPLATE_TYPE(Value))
BOOST_CHECK_EQUAL( counter, 1); BOOST_CHECK_EQUAL( counter, 1);
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test<int>(); // ("builtin"); test<int>(); // ("builtin");
test<custom>(); // ("custom "); test<custom>(); // ("custom ");
return 0;
} }

View File

@ -9,58 +9,63 @@
import testing ; import testing ;
alias unit_test_framework
: # sources
/boost//unit_test_framework
;
test-suite algorithm/string test-suite algorithm/string
: [ run : [ run
trim_test.cpp trim_test.cpp unit_test_framework
: : : :
: :
: trim : trim
] ]
[ run [ run
conv_test.cpp conv_test.cpp unit_test_framework
: : : :
: :
: conv : conv
] ]
[ run [ run
predicate_test.cpp predicate_test.cpp unit_test_framework
: : : :
: :
: predicate : predicate
] ]
[ run [ run
find_test.cpp find_test.cpp unit_test_framework
: : : :
: :
: find : find
] ]
[ run [ run
split_test.cpp split_test.cpp unit_test_framework
: : : :
: :
: split : split
] ]
[ run [ run
join_test.cpp join_test.cpp unit_test_framework
: : : :
: :
: join : join
] ]
[ run [ run
replace_test.cpp replace_test.cpp unit_test_framework
: : : :
: :
: replace : replace
] ]
[ run [ run
regex_test.cpp regex_test.cpp unit_test_framework
../../../regex/build//boost_regex ../../../regex/build//boost_regex
: : : :
: :
: regex : regex
] ]
[ run [ run
find_format_test.cpp find_format_test.cpp unit_test_framework
: : : :
: :
: find_format : find_format

View File

@ -10,7 +10,8 @@
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -87,9 +88,7 @@ void conv_test()
} }
// test main // test main
int test_main( int, char*[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
conv_test(); conv_test();
return 0;
} }

View File

@ -12,7 +12,8 @@
#include <boost/algorithm/string/formatter.hpp> #include <boost/algorithm/string/formatter.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp> #include <boost/test/test_tools.hpp>
@ -154,10 +155,8 @@ void find_format_all_test()
BOOST_CHECK_EQUAL(output, source); BOOST_CHECK_EQUAL(output, source);
} }
int test_main( int, char*[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
find_format_test(); find_format_test();
find_format_all_test(); find_format_all_test();
return 0;
} }

View File

@ -12,7 +12,8 @@
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -45,7 +46,7 @@ void find_test()
// find_first // find_first
BOOST_CHECKPOINT( "find_first" ); BOOST_TEST_CHECKPOINT( "find_first" );
nc_result=find_first( str1, string("abc") ); nc_result=find_first( str1, string("abc") );
BOOST_CHECK( BOOST_CHECK(
@ -66,7 +67,7 @@ void find_test()
BOOST_CHECK(( (ch_result.begin() - pch1 ) == 3) && ( (ch_result.end() - pch1 ) == 6 ) ); BOOST_CHECK(( (ch_result.begin() - pch1 ) == 3) && ( (ch_result.end() - pch1 ) == 6 ) );
// find_last // find_last
BOOST_CHECKPOINT( "find_last" ); BOOST_TEST_CHECKPOINT( "find_last" );
nc_result=find_last( str1, string("abc") ); nc_result=find_last( str1, string("abc") );
BOOST_CHECK( BOOST_CHECK(
@ -87,7 +88,7 @@ void find_test()
BOOST_CHECK(( (ch_result.begin() - pch1 ) == 15) && ( (ch_result.end() - pch1 ) == 18 ) ); BOOST_CHECK(( (ch_result.begin() - pch1 ) == 15) && ( (ch_result.end() - pch1 ) == 18 ) );
// find_nth // find_nth
BOOST_CHECKPOINT( "find_nth" ); BOOST_TEST_CHECKPOINT( "find_nth" );
nc_result=find_nth( str1, string("abc"), 1 ); nc_result=find_nth( str1, string("abc"), 1 );
BOOST_CHECK( BOOST_CHECK(
@ -125,7 +126,7 @@ void find_test()
BOOST_CHECK(( (ch_result.begin() - pch1 ) == 9) && ( (ch_result.end() - pch1 ) == 12 ) ); BOOST_CHECK(( (ch_result.begin() - pch1 ) == 9) && ( (ch_result.end() - pch1 ) == 12 ) );
// find_head // find_head
BOOST_CHECKPOINT( "find_head" ); BOOST_TEST_CHECKPOINT( "find_head" );
nc_result=find_head( str1, 6 ); nc_result=find_head( str1, 6 );
BOOST_CHECK( BOOST_CHECK(
@ -146,7 +147,7 @@ void find_test()
BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 0 ) && ( (ch_result.end() - pch1 ) == 6 ) ); BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 0 ) && ( (ch_result.end() - pch1 ) == 6 ) );
// find_tail // find_tail
BOOST_CHECKPOINT( "find_tail" ); BOOST_TEST_CHECKPOINT( "find_tail" );
nc_result=find_tail( str1, 6 ); nc_result=find_tail( str1, 6 );
BOOST_CHECK( BOOST_CHECK(
@ -168,7 +169,7 @@ void find_test()
BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 15 ) && ( (ch_result.end() - pch1 ) == 21 ) ); BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 15 ) && ( (ch_result.end() - pch1 ) == 21 ) );
// find_token // find_token
BOOST_CHECKPOINT( "find_token" ); BOOST_TEST_CHECKPOINT( "find_token" );
nc_result=find_token( str1, is_any_of("abc"), token_compress_on ); nc_result=find_token( str1, is_any_of("abc"), token_compress_on );
BOOST_CHECK( BOOST_CHECK(
@ -194,7 +195,7 @@ void find_test()
BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 3 ) && ( (ch_result.end() - pch1 ) == 4 ) ); BOOST_CHECK( ( (ch_result.begin() - pch1 ) == 3 ) && ( (ch_result.end() - pch1 ) == 4 ) );
// generic find // generic find
BOOST_CHECKPOINT( "generic find" ); BOOST_TEST_CHECKPOINT( "generic find" );
nc_result=find(str1, first_finder(string("abc"))); nc_result=find(str1, first_finder(string("abc")));
BOOST_CHECK( BOOST_CHECK(
@ -207,7 +208,7 @@ void find_test()
( (cv_result.end()-str1.begin()) == 6) ); ( (cv_result.end()-str1.begin()) == 6) );
// multi-type comparison test // multi-type comparison test
BOOST_CHECKPOINT( "multi-type" ); BOOST_TEST_CHECKPOINT( "multi-type" );
nc_vresult=find_first( vec1, string("abc") ); nc_vresult=find_first( vec1, string("abc") );
BOOST_CHECK( BOOST_CHECK(
@ -220,7 +221,7 @@ void find_test()
( (cv_result.end()-str1.begin()) == 6) ); ( (cv_result.end()-str1.begin()) == 6) );
// overflow test // overflow test
BOOST_CHECKPOINT( "overflow" ); BOOST_TEST_CHECKPOINT( "overflow" );
nc_result=find_first( str2, string("abcd") ); nc_result=find_first( str2, string("abcd") );
BOOST_CHECK( nc_result.begin()==nc_result.end() ); 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") ); BOOST_CHECK( string( cv_result.begin(), cv_result.end() )== string("abc") );
// Empty string test // Empty string test
BOOST_CHECKPOINT( "empty" ); BOOST_TEST_CHECKPOINT( "empty" );
nc_result=find_first( str3, string("abcd") ); nc_result=find_first( str3, string("abcd") );
BOOST_CHECK( nc_result.begin()==nc_result.end() ); BOOST_CHECK( nc_result.begin()==nc_result.end() );
@ -251,7 +252,7 @@ void find_test()
BOOST_CHECK( osstr.str()=="abc" ); BOOST_CHECK( osstr.str()=="abc" );
// Empty string test // Empty string test
BOOST_CHECKPOINT( "overlapping" ); BOOST_TEST_CHECKPOINT( "overlapping" );
std::string overlap_target("aaaa"); std::string overlap_target("aaaa");
std::vector<boost::iterator_range<std::string::iterator> > overlap_results; std::vector<boost::iterator_range<std::string::iterator> > overlap_results;
@ -266,9 +267,7 @@ void find_test()
} }
// test main // test main
int test_main( int, char*[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
find_test(); find_test();
return 0;
} }

View File

@ -13,7 +13,8 @@
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -70,10 +71,8 @@ void join_test()
BOOST_CHECK( equals(join_if(tokens3, "-", is_not_empty), "") ); BOOST_CHECK( equals(join_if(tokens3, "-", is_not_empty), "") );
} }
// test main
int test_main( int, char*[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
join_test(); join_test();
return 0;
} }

View File

@ -11,7 +11,8 @@
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -152,11 +153,8 @@ void classification_test()
#undef TEST_CLASS #undef TEST_CLASS
// test main BOOST_AUTO_TEST_CASE( test_main )
int test_main( int, char*[] )
{ {
predicate_test(); predicate_test();
classification_test(); classification_test();
return 0;
} }

View File

@ -15,7 +15,8 @@
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -149,11 +150,9 @@ static void replace_test()
BOOST_CHECK( str1==string("123AxXxCa23ca456c321") ); BOOST_CHECK( str1==string("123AxXxCa23ca456c321") );
} }
int test_main( int, char*[] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
find_test(); find_test();
join_test(); join_test();
replace_test(); replace_test();
return 0;
} }

View File

@ -16,7 +16,8 @@
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -56,14 +57,14 @@ void sequence_traits_test()
#define C_ , #define C_ ,
#define TEST_ALGO( Algo, Input, Params, Output ) \ #define TEST_ALGO( Algo, Input, Params, Output ) \
{\ {\
BOOST_CHECKPOINT( #Algo " - Copy" );\ BOOST_TEST_CHECKPOINT( #Algo " - Copy" );\
\ \
string str1(Input);\ string str1(Input);\
\ \
/* Copy test */ \ /* Copy test */ \
BOOST_CHECK( Algo##_copy( str1, Params )==Output );\ BOOST_CHECK( Algo##_copy( str1, Params )==Output );\
\ \
BOOST_CHECKPOINT( #Algo " - Iterator" );\ BOOST_TEST_CHECKPOINT( #Algo " - Iterator" );\
/* Iterator test */\ /* Iterator test */\
string strout;\ string strout;\
Algo##_copy( back_inserter(strout), str1, Params );\ Algo##_copy( back_inserter(strout), str1, Params );\
@ -73,15 +74,15 @@ void sequence_traits_test()
vector<char> vec1( str1.begin(), str1.end() );\ vector<char> vec1( str1.begin(), str1.end() );\
list<char> list1( str1.begin(), str1.end() );\ list<char> list1( str1.begin(), str1.end() );\
\ \
BOOST_CHECKPOINT( #Algo " - Inplace(string)" );\ BOOST_TEST_CHECKPOINT( #Algo " - Inplace(string)" );\
Algo( str1, Params ); \ Algo( str1, Params ); \
BOOST_CHECK( equals( str1, Output ) ); \ BOOST_CHECK( equals( str1, Output ) ); \
\ \
BOOST_CHECKPOINT( #Algo " - Inplace(vector)" );\ BOOST_TEST_CHECKPOINT( #Algo " - Inplace(vector)" );\
Algo( vec1, Params ); \ Algo( vec1, Params ); \
BOOST_CHECK( equals( vec1, Output ) );\ BOOST_CHECK( equals( vec1, Output ) );\
\ \
BOOST_CHECKPOINT( #Algo " - Inplace(list)" );\ BOOST_TEST_CHECKPOINT( #Algo " - Inplace(list)" );\
Algo( list1, Params ); \ Algo( list1, Params ); \
BOOST_CHECK( equals( list1, Output ) );\ BOOST_CHECK( equals( list1, Output ) );\
} }
@ -206,7 +207,7 @@ void replace_range_test()
{ {
// replace_range // replace_range
{ {
BOOST_CHECKPOINT( "replace_range" ); BOOST_TEST_CHECKPOINT( "replace_range" );
string str1("1abc3abc2"); string str1("1abc3abc2");
BOOST_CHECK( BOOST_CHECK(
@ -231,7 +232,7 @@ void replace_range_test()
} }
// erase_range // erase_range
{ {
BOOST_CHECKPOINT( "erase_range" ); BOOST_TEST_CHECKPOINT( "erase_range" );
string str1("1abc3abc2"); string str1("1abc3abc2");
BOOST_CHECK( BOOST_CHECK(
@ -305,8 +306,7 @@ void dissect_format_test()
} }
// test main BOOST_AUTO_TEST_CASE( test_main )
int test_main( int, char*[] )
{ {
sequence_traits_test(); sequence_traits_test();
replace_first_test(); replace_first_test();
@ -318,6 +318,4 @@ int test_main( int, char*[] )
replace_range_test(); replace_range_test();
collection_comp_test(); collection_comp_test();
dissect_format_test(); dissect_format_test();
return 0;
} }

View File

@ -13,10 +13,12 @@
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include <list>
#include <iostream> #include <iostream>
#include <boost/test/test_tools.hpp> #include <boost/test/test_tools.hpp>
@ -179,12 +181,15 @@ void iterator_test()
BOOST_CHECK(siter==split_iterator<string::iterator>(siter)); BOOST_CHECK(siter==split_iterator<string::iterator>(siter));
BOOST_CHECK(siter==split_iterator<string::iterator>()); BOOST_CHECK(siter==split_iterator<string::iterator>());
#if 0
// Make sure we work with forward iterators
// See bug #7989
list<char> l1;
find_iterator<list<char>::iterator> liter=make_find_iterator(l1, first_finder("xx"));
#endif
} }
// test main BOOST_AUTO_TEST_CASE( test_main )
int test_main( int, char*[] )
{ {
iterator_test(); iterator_test();
return 0;
} }

View File

@ -11,7 +11,8 @@
#include <boost/algorithm/string/trim_all.hpp> #include <boost/algorithm/string/trim_all.hpp>
// Include unit test framework // Include unit test framework
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -193,12 +194,9 @@ void trim_fill_test()
BOOST_CHECK( trim_fill_copy_if( string("<>abc<>def<>"), "-", is_any_of( "<<>>" ) )=="abc-def" ); BOOST_CHECK( trim_fill_copy_if( string("<>abc<>def<>"), "-", is_any_of( "<<>>" ) )=="abc-def" );
} }
// test main BOOST_AUTO_TEST_CASE( test_main )
int test_main( int, char*[] )
{ {
trim_test(); trim_test();
trim_all_test(); trim_all_test();
trim_fill_test(); trim_fill_test();
return 0;
} }

View File

@ -9,51 +9,60 @@
import testing ; import testing ;
alias unit_test_framework
: # sources
/boost//unit_test_framework
;
{ {
test-suite algorithm: test-suite algorithm:
# Search tests # Search tests
: [ run empty_search_test.cpp : : : : empty_search_test ] : [ run empty_search_test.cpp unit_test_framework : : : : empty_search_test ]
[ run search_test1.cpp : : : : search_test1 ] [ run search_test1.cpp unit_test_framework : : : : search_test1 ]
[ run search_test2.cpp : : : : search_test2 ] [ run search_test2.cpp unit_test_framework : : : : search_test2 ]
[ run search_test3.cpp : : : : search_test3 ] [ run search_test3.cpp unit_test_framework : : : : search_test3 ]
[ run search_test4.cpp : : : : search_test4 ] [ run search_test4.cpp unit_test_framework : : : : search_test4 ]
[ compile-fail search_fail1.cpp : : : : ] [ compile-fail search_fail1.cpp : : : : ]
[ compile-fail search_fail2.cpp : : : : ] [ compile-fail search_fail2.cpp : : : : ]
[ compile-fail search_fail3.cpp : : : : ] [ compile-fail search_fail3.cpp : : : : ]
# Clamp tests # Clamp tests
[ run clamp_test.cpp : : : : clamp_test ] [ run clamp_test.cpp unit_test_framework : : : : clamp_test ]
# Cxx11 tests # Cxx11 tests
[ run all_of_test.cpp : : : : all_of_test ] [ run all_of_test.cpp unit_test_framework : : : : all_of_test ]
[ run any_of_test.cpp : : : : any_of_test ] [ run any_of_test.cpp unit_test_framework : : : : any_of_test ]
[ run none_of_test.cpp : : : : none_of_test ] [ run none_of_test.cpp unit_test_framework : : : : none_of_test ]
[ run one_of_test.cpp : : : : one_of_test ] [ run one_of_test.cpp unit_test_framework : : : : one_of_test ]
[ run ordered_test.cpp : : : : ordered_test ] [ run ordered_test.cpp unit_test_framework : : : : ordered_test ]
[ run find_if_not_test1.cpp : : : : find_if_not_test1 ] [ run find_if_not_test1.cpp unit_test_framework : : : : find_if_not_test1 ]
[ run copy_if_test1.cpp : : : : copy_if_test1 ] [ run copy_if_test1.cpp unit_test_framework : : : : copy_if_test1 ]
[ run copy_n_test1.cpp : : : : copy_n_test1 ] [ run copy_n_test1.cpp unit_test_framework : : : : copy_n_test1 ]
[ run iota_test1.cpp : : : : iota_test1 ] [ run iota_test1.cpp unit_test_framework : : : : iota_test1 ]
[ run is_permutation_test1.cpp : : : : is_permutation_test1 ] [ run is_permutation_test1.cpp unit_test_framework : : : : is_permutation_test1 ]
[ run partition_point_test1.cpp : : : : partition_point_test1 ] [ run partition_point_test1.cpp unit_test_framework : : : : partition_point_test1 ]
[ run is_partitioned_test1.cpp : : : : is_partitioned_test1 ] [ run is_partitioned_test1.cpp unit_test_framework : : : : is_partitioned_test1 ]
[ run partition_copy_test1.cpp : : : : partition_copy_test1 ] [ run partition_copy_test1.cpp unit_test_framework : : : : partition_copy_test1 ]
# Hex tests # Hex tests
[ run hex_test1.cpp : : : : hex_test1 ] [ run hex_test1.cpp unit_test_framework : : : : hex_test1 ]
[ run hex_test2.cpp : : : : hex_test2 ] [ run hex_test2.cpp unit_test_framework : : : : hex_test2 ]
[ run hex_test3.cpp : : : : hex_test3 ] [ run hex_test3.cpp unit_test_framework : : : : hex_test3 ]
[ run hex_test4.cpp : : : : hex_test4 ] [ run hex_test4.cpp unit_test_framework : : : : hex_test4 ]
[ compile-fail hex_fail1.cpp ] [ compile-fail hex_fail1.cpp ]
# Wrapper tests # Wrapper tests
[ run wrapper_test1.cpp : : : : wrapper_test1 ] [ run wrapper_test1.cpp unit_test_framework : : : : wrapper_test1 ]
# Gather tests # Gather tests
[ run gather_test1.cpp : : : : gather_test1 ] [ run gather_test1.cpp unit_test_framework : : : : gather_test1 ]
[ compile-fail gather_fail1.cpp ] [ compile-fail gather_fail1.cpp ]
# Dummy test
[ run dummy_test.cpp unit_test_framework : : : : dummy_test ]
; ;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/all_of.hpp> #include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -79,8 +81,7 @@ void test_all ()
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_all (); test_all ();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/any_of.hpp> #include <boost/algorithm/cxx11/any_of.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -98,8 +100,7 @@ void test_any ()
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_any (); test_any ();
return 0;
} }

View File

@ -9,7 +9,8 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/clamp.hpp> #include <boost/algorithm/clamp.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
namespace ba = boost::algorithm; namespace ba = boost::algorithm;
@ -205,7 +206,7 @@ void test_int_range ()
BOOST_CHECK ( std::equal ( b_e(junk), outputs )); BOOST_CHECK ( std::equal ( b_e(junk), outputs ));
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_ints (); test_ints ();
test_floats (); test_floats ();
@ -214,5 +215,4 @@ int test_main( int , char* [] )
test_int_range (); test_int_range ();
// test_float_range (); // test_float_range ();
// test_custom_range (); // test_custom_range ();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/copy_if.hpp> #include <boost/algorithm/cxx11/copy_if.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
@ -57,12 +59,12 @@ void test_sequence ( Container const &c ) {
// Some of the elements // Some of the elements
v.clear (); v.clear ();
ba::copy_if ( c.begin (), c.end (), back_inserter ( v ), is_even ); 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 )); BOOST_CHECK ( ba::all_of ( v.begin (), v.end (), is_even ));
v.clear (); v.clear ();
ba::copy_if ( c, back_inserter ( v ), is_even ); 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 )); 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 (); test_sequence1 ();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/copy_n.hpp> #include <boost/algorithm/cxx11/copy_n.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -78,8 +80,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -13,9 +13,10 @@
#include <boost/algorithm/searching/boyer_moore_horspool.hpp> #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp> #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
int test_main( int argc, char *argv [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
const std::string cs; const std::string cs;
std::string estr; std::string estr;
@ -77,7 +78,4 @@ int test_main( int argc, char *argv [] )
str.begin (), str.end (), estr.begin (), estr.end ()) str.begin (), str.end (), estr.begin (), estr.end ())
== str.begin () == str.begin ()
); );
(void) argv; (void) argc;
return 0;
} }

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/find_if_not.hpp> #include <boost/algorithm/cxx11/find_if_not.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -83,8 +85,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -11,7 +11,6 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/gather.hpp> #include <boost/algorithm/gather.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -32,7 +31,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) int main ()
{ {
test_sequence1 (); test_sequence1 ();
return 0; return 0;

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/gather.hpp> #include <boost/algorithm/gather.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -132,8 +134,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -9,17 +9,17 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
// should not compile: vector is not an integral type // should not compile: vector is not an integral type
int test_main( int , char* [] ) int main( int , char* [] )
{ {
std::vector<float> v; std::vector<float> v;
std::string out; std::string out;
boost::algorithm::unhex ( out, std::back_inserter(v)); boost::algorithm::unhex ( out, std::back_inserter(v));
return 0; return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -141,7 +143,7 @@ const wchar_t *fromhex_fail_w [] = {
}; };
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_to_hex<std::string> ( tohex ); test_to_hex<std::string> ( tohex );
test_from_hex_success<std::string> ( fromhex ); test_from_hex_success<std::string> ( fromhex );
@ -150,5 +152,4 @@ int test_main( int , char* [] )
test_to_hex<std::wstring> ( tohex_w ); test_to_hex<std::wstring> ( tohex_w );
test_from_hex_success<std::wstring> ( fromhex_w ); test_from_hex_success<std::wstring> ( fromhex_w );
test_from_hex_failure<std::wstring> ( fromhex_fail_w ); test_from_hex_failure<std::wstring> ( fromhex_fail_w );
return 0;
} }

View File

@ -11,7 +11,9 @@ Test non-string cases; vector and list
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -129,9 +131,8 @@ void test_from_hex_success () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_to_hex (); test_to_hex ();
test_from_hex_success (); test_from_hex_success ();
return 0;
} }

View File

@ -11,7 +11,9 @@ Try ostream_iterators
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -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 );
test_to_hex ( tohex_w ); test_to_hex ( tohex_w );
test_from_hex_success ( fromhex ); test_from_hex_success ( fromhex );
test_from_hex_success ( fromhex_w ); test_from_hex_success ( fromhex_w );
return 0;
} }

View File

@ -11,7 +11,9 @@ Try ostream_iterators
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/hex.hpp> #include <boost/algorithm/hex.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -136,10 +138,8 @@ void test_nonhex_input () {
test_nonhex_input4 (); test_nonhex_input4 ();
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_short_input (); test_short_input ();
test_nonhex_input (); test_nonhex_input ();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/iota.hpp> #include <boost/algorithm/cxx11/iota.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -72,8 +74,7 @@ void test_ints () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_ints (); test_ints ();
return 0;
} }

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/is_partitioned.hpp> #include <boost/algorithm/cxx11/is_partitioned.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -56,8 +58,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/is_permutation.hpp> #include <boost/algorithm/cxx11/is_permutation.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -42,8 +44,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/none_of.hpp> #include <boost/algorithm/cxx11/none_of.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -89,8 +91,7 @@ void test_none()
BOOST_CHECK (!ba::none_of ( li.begin(), l_iter, is_<int> ( 5 ))); BOOST_CHECK (!ba::none_of ( li.begin(), l_iter, is_<int> ( 5 )));
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_none(); test_none();
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/one_of.hpp> #include <boost/algorithm/cxx11/one_of.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -94,8 +96,7 @@ void test_one ()
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_one (); test_one ();
return 0;
} }

View File

@ -13,7 +13,9 @@
#include <iostream> #include <iostream>
#include <boost/algorithm/cxx11/is_sorted.hpp> #include <boost/algorithm/cxx11/is_sorted.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
using namespace boost; 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_ordered ();
test_increasing_decreasing (); test_increasing_decreasing ();
return 0;
} }

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/partition_copy.hpp> #include <boost/algorithm/cxx11/partition_copy.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/cxx11/all_of.hpp> #include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/algorithm/cxx11/none_of.hpp> #include <boost/algorithm/cxx11/none_of.hpp>
@ -80,8 +82,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -11,7 +11,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/cxx11/partition_point.hpp> #include <boost/algorithm/cxx11/partition_point.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -91,8 +93,7 @@ void test_sequence1 () {
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_sequence1 (); test_sequence1 ();
return 0;
} }

View File

@ -10,7 +10,7 @@
#include <vector> #include <vector>
#include <boost/algorithm/searching/boyer_moore.hpp> #include <boost/algorithm/searching/boyer_moore.hpp>
int main( int argc, char *argv [] ) int main( int , char* [] )
{ {
std::vector<char> cv; std::vector<char> cv;
std::vector<int> iv; std::vector<int> iv;
@ -20,7 +20,5 @@ int main( int argc, char *argv [] )
(void) boost::algorithm::boyer_moore_search ( (void) boost::algorithm::boyer_moore_search (
cv.begin (), cv.end (), iv.begin (), iv.end ()); cv.begin (), cv.end (), iv.begin (), iv.end ());
(void) argv; (void) argc;
return 0; return 0;
} }

View File

@ -11,7 +11,7 @@
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/algorithm/searching/boyer_moore.hpp> #include <boost/algorithm/searching/boyer_moore.hpp>
int main( int argc, char *argv [] ) int main( int , char* [] )
{ {
std::vector<boost::uint8_t> cv; std::vector<boost::uint8_t> cv;
std::vector<boost:: int8_t> iv; std::vector<boost:: int8_t> iv;
@ -21,7 +21,5 @@ int main( int argc, char *argv [] )
(void) boost::algorithm::boyer_moore_search ( (void) boost::algorithm::boyer_moore_search (
cv.begin (), cv.end (), iv.begin (), iv.end ()); cv.begin (), cv.end (), iv.begin (), iv.end ());
(void) argv; (void) argc;
return 0; return 0;
} }

View File

@ -10,11 +10,10 @@
#include <vector> #include <vector>
#include <boost/algorithm/searching/boyer_moore.hpp> #include <boost/algorithm/searching/boyer_moore.hpp>
int main( int argc, char *argv [] ) int main( int , char* [] )
{ {
// Should fail to compile because the search objects are not default-constructible // Should fail to compile because the search objects are not default-constructible
boost::algorithm::boyer_moore<std::vector<char>::iterator> bm; boost::algorithm::boyer_moore<std::vector<char>::iterator> bm;
(void) argv; (void) argc;
return 0; return 0;
} }

View File

@ -11,7 +11,8 @@
#include <boost/algorithm/searching/boyer_moore_horspool.hpp> #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp> #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -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 haystack1 ( "NOW AN FOWE\220ER ANNMAN THE ANPANMANEND" );
std::string needle1 ( "ANPANMAN" ); std::string needle1 ( "ANPANMAN" );
@ -268,5 +269,4 @@ int test_main( int , char* [] )
const std::string mikhail_corpus = std::string (8, 'a') + mikhail_pattern; const std::string mikhail_corpus = std::string (8, 'a') + mikhail_pattern;
check_one ( mikhail_corpus, mikhail_pattern, 8 ); check_one ( mikhail_corpus, mikhail_pattern, 8 );
return 0;
} }

View File

@ -11,9 +11,12 @@
#include <boost/algorithm/searching/boyer_moore_horspool.hpp> #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp> #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
@ -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 c1 = ReadFromFile ( "search_test_data/0001.corpus" );
vec p1b = ReadFromFile ( "search_test_data/0001b.pat" ); 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 ()); check_one ( c1, p1e, c1.size() - p1e.size ());
std::cout << "--- Not found ---" << std::endl; std::cout << "--- Not found ---" << std::endl;
check_one ( c1, p1n, -1 ); // Not found check_one ( c1, p1n, -1 ); // Not found
return 0;
} }

View File

@ -11,9 +11,12 @@
#include <boost/algorithm/searching/boyer_moore_horspool.hpp> #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp> #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <string> #include <string>
@ -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 c1 = ReadFromFile ( "search_test_data/0001.corpus" );
vec p1b = ReadFromFile ( "search_test_data/0002b.pat" ); 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 ()); check_one ( c1, p1e, c1.size() - p1e.size ());
std::cout << "--- Not found ---" << std::endl; std::cout << "--- Not found ---" << std::endl;
check_one ( c1, p1n, -1 ); // Not found check_one ( c1, p1n, -1 ); // Not found
return 0;
} }

View File

@ -13,9 +13,12 @@
#include <boost/algorithm/searching/boyer_moore_horspool.hpp> #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp> #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <boost/test/included/test_exec_monitor.hpp> #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <string> #include <string>
@ -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 c1 = ReadFromFile ( "search_test_data/0001.corpus" );
vec p1b = ReadFromFile ( "search_test_data/0002b.pat" ); 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 ()); check_one ( c1, p1e, c1.size() - p1e.size ());
std::cout << "--- Not found ---" << std::endl; std::cout << "--- Not found ---" << std::endl;
check_one ( c1, p1n, -1 ); // Not found check_one ( c1, p1n, -1 ); // Not found
return 0;
} }

View File

@ -9,7 +9,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/algorithm/wrappers.hpp> #include <boost/algorithm/wrappers.hpp>
#include <boost/test/included/test_exec_monitor.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <functional> #include <functional>
#include <string> #include <string>
@ -67,9 +69,8 @@ void test_str ()
BOOST_CHECK ( ba::find_ptr ( mm, 55 ) == NULL ); BOOST_CHECK ( ba::find_ptr ( mm, 55 ) == NULL );
} }
int test_main( int , char* [] ) BOOST_AUTO_TEST_CASE( test_main )
{ {
test_int (); test_int ();
test_str (); test_str ();
return 0;
} }