diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 58bc06f..8f9dc8c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -4,12 +4,9 @@ import testing ; -test-suite tokenizer -: [ run examples.cpp - /boost/test//boost_test_exec_monitor/static ] - [ run simple_example_1.cpp ] - [ run simple_example_2.cpp ] - [ run simple_example_3.cpp ] - [ run simple_example_4.cpp ] - [ run simple_example_5.cpp ] - ; +run examples.cpp ; +run simple_example_1.cpp ; +run simple_example_2.cpp ; +run simple_example_3.cpp ; +run simple_example_4.cpp ; +run simple_example_5.cpp ; diff --git a/test/examples.cpp b/test/examples.cpp index 1e0b69b..93c308e 100644 --- a/test/examples.cpp +++ b/test/examples.cpp @@ -15,9 +15,9 @@ #include #include -#include +#include -int test_main( int /*argc*/, char* /*argv*/[] ) +int main() { using namespace boost; @@ -28,7 +28,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) typedef tokenizer > Tok; char_separator sep("-;|"); Tok t(test_string, sep); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } { const std::string test_string = ";;Hello|world||-foo--bar;yow;baz|"; @@ -37,14 +37,14 @@ int test_main( int /*argc*/, char* /*argv*/[] ) typedef tokenizer > Tok; char_separator sep("-;", "|", boost::keep_empty_tokens); Tok t(test_string, sep); - BOOST_REQUIRE(std::equal(t.begin(), t.end(), answer)); + BOOST_TEST(std::equal(t.begin(), t.end(), answer)); } { const std::string test_string = "This,,is, a.test.."; std::string answer[] = {"This","is","a","test"}; typedef tokenizer<> Tok; Tok t(test_string); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } { @@ -52,7 +52,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) std::string answer[] = {"Field 1","embedded,comma","quote \""," escape \\"}; typedef tokenizer > Tok; Tok t(test_string); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } { @@ -61,7 +61,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) typedef tokenizer > Tok; escaped_list_separator sep("\\^",",;","\"\'"); Tok t(test_string,sep); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } { @@ -71,7 +71,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) boost::array offsets = {{2,2,4}}; offset_separator func(offsets.begin(),offsets.end()); Tok t(test_string,func); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } // Use token_iterator_generator @@ -82,7 +82,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) Iter begin = make_token_iterator(test_string.begin(), test_string.end(),char_delimiters_separator()); Iter end; - BOOST_REQUIRE(std::equal(begin,end,answer)); + BOOST_TEST(std::equal(begin,end,answer)); } { @@ -93,14 +93,14 @@ int test_main( int /*argc*/, char* /*argv*/[] ) test_string.end(),escaped_list_separator()); Iter begin_c(begin); Iter end; - BOOST_REQUIRE(std::equal(begin,end,answer)); + BOOST_TEST(std::equal(begin,end,answer)); while(begin_c != end) { - BOOST_REQUIRE(begin_c.at_end() == 0); + BOOST_TEST(begin_c.at_end() == 0); ++begin_c; } - BOOST_REQUIRE(begin_c.at_end()); + BOOST_TEST(begin_c.at_end()); } { @@ -113,7 +113,7 @@ int test_main( int /*argc*/, char* /*argv*/[] ) test_string.end(),func); Iter end= make_token_iterator(test_string.end(), test_string.end(),func); - BOOST_REQUIRE(std::equal(begin,end,answer)); + BOOST_TEST(std::equal(begin,end,answer)); } // Test copying @@ -128,13 +128,13 @@ int test_main( int /*argc*/, char* /*argv*/[] ) other = beg; ++other; - BOOST_REQUIRE(*beg=="bc"); - BOOST_REQUIRE(*other=="def"); + BOOST_TEST(*beg=="bc"); + BOOST_TEST(*other=="def"); other = make_token_iterator(test_string.begin(), test_string.end(),f); - BOOST_REQUIRE(*other=="a"); + BOOST_TEST(*other=="a"); } // Test non-default constructed char_delimiters_separator @@ -142,9 +142,8 @@ int test_main( int /*argc*/, char* /*argv*/[] ) const std::string test_string = "how,are you, doing"; std::string answer[] = {"how",",","are you",","," doing"}; tokenizer<> t(test_string,char_delimiters_separator(true,",","")); - BOOST_REQUIRE(std::equal(t.begin(),t.end(),answer)); + BOOST_TEST(std::equal(t.begin(),t.end(),answer)); } - return 0; + return boost::report_errors(); } -