Switch from deprecated test to Lightweight Test
This commit is contained in:
parent
b84609588a
commit
f0857f042d
|
@ -4,12 +4,9 @@
|
|||
|
||||
import testing ;
|
||||
|
||||
test-suite tokenizer
|
||||
: [ run examples.cpp
|
||||
/boost/test//boost_test_exec_monitor/<link>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 ;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
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<char_separator<char> > Tok;
|
||||
char_separator<char> 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<char_separator<char> > Tok;
|
||||
char_separator<char> 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<escaped_list_separator<char> > 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<escaped_list_separator<char> > Tok;
|
||||
escaped_list_separator<char> 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<int,3> 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<std::string>(test_string.begin(),
|
||||
test_string.end(),char_delimiters_separator<char>());
|
||||
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<char>());
|
||||
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<std::string>(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<std::string>(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<char>(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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue