Merged boost::algorithm::gather and updated tests for Utility, Algorithm and Utility libraries

[SVN r83154]
This commit is contained in:
Marshall Clow
2013-02-25 18:43:26 +00:00
parent 6e098b27aa
commit 8132864884
42 changed files with 221 additions and 194 deletions

View File

@ -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

View File

@ -10,7 +10,8 @@
#include <boost/algorithm/string/case_conv.hpp>
// 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 <iostream>
@ -87,9 +88,7 @@ void conv_test()
}
// test main
int test_main( int, char*[] )
BOOST_AUTO_TEST_CASE( test_main )
{
conv_test();
return 0;
}

View File

@ -12,7 +12,8 @@
#include <boost/algorithm/string/formatter.hpp>
// 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>
@ -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;
}

View File

@ -12,7 +12,8 @@
#include <boost/algorithm/string/split.hpp>
// 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 <vector>
@ -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<boost::iterator_range<std::string::iterator> > 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;
}

View File

@ -13,7 +13,8 @@
#include <boost/algorithm/string/predicate.hpp>
// 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 <vector>
@ -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;
}

View File

@ -11,7 +11,8 @@
#include <boost/algorithm/string/classification.hpp>
// 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 <vector>
@ -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;
}

View File

@ -15,7 +15,8 @@
// 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 <vector>
@ -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;
}

View File

@ -16,7 +16,8 @@
#include <boost/algorithm/string/classification.hpp>
// 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 <vector>
@ -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<char> vec1( 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 ); \
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;
}

View File

@ -13,10 +13,12 @@
#include <boost/algorithm/string/predicate.hpp>
// 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 <vector>
#include <list>
#include <iostream>
#include <boost/test/test_tools.hpp>
@ -44,7 +46,7 @@ void iterator_test()
const char* pch1="xx-abc--xx-abb";
vector<string> tokens;
vector< vector<int> > vtokens;
// find_all tests
find_all(
tokens,
@ -179,12 +181,15 @@ void iterator_test()
BOOST_CHECK(siter==split_iterator<string::iterator>(siter));
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
int test_main( int, char*[] )
BOOST_AUTO_TEST_CASE( test_main )
{
iterator_test();
return 0;
}

View File

@ -11,7 +11,8 @@
#include <boost/algorithm/string/trim_all.hpp>
// 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 <iostream>
@ -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;
}