Ticket #9063: find_iterator_test.cpp

File find_iterator_test.cpp, 1.1 KB (added by Jim Bell <jim@…>, 9 years ago)

test case for make_find_iterator/token_finder/token_compress_on

Line 
1//
2// Works against boost_1_48_0, fails on 1_53_0
3// g++ -Ie:/Software/Open/lib/boost_1_48_0 -o fi.exe find_iterator_test.cpp && fi.exe
4// g++ -IF:/boost/GCC/release/boost -o fi.exe find_iterator_test.cpp && fi.exe
5//
6#include <string>
7#include <boost/algorithm/string.hpp>
8#include <boost/test/included/test_exec_monitor.hpp>
9#include <boost/test/test_tools.hpp>
10
11using namespace boost::algorithm;
12using namespace std;
13
14void find_iterator_test()
15 {
16 string s1("abc def ghi jkl");
17
18 //BOOST_CHECKPOINT("make_find_iterator ... token_compress_on");
19 find_iterator<string::iterator> fEnd;
20
21 find_iterator<string::iterator> fxIt =
22 make_find_iterator(s1,
23 token_finder(is_alnum(), token_compress_on));
24
25 BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("abc")));
26 ++fxIt;
27 BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("def")));
28 ++fxIt;
29 BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("ghi")));
30 ++fxIt;
31 BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("jkl")));
32 ++fxIt;
33 BOOST_CHECK(fxIt == fEnd);
34 }
35
36int test_main( int, char*[] )
37 {
38 find_iterator_test();
39 return 0;
40 }