patch tokenizer offset_separator implementation

*** token_functions.hpp.orig Tue Nov 21 14:49:40 2006 --- token_functions.hpp Tue Nov 21 14:51:44 2006 *************** *** 350,356 **** assigner::assign(start,next,tok); if (!return_partial_last_) ! if (i < (c-1) ) return false; ++current_offset_; --- 350,356 ---- assigner::assign(start,next,tok); if (!return_partial_last_) ! if (i < c) return false; ++current_offset_;

CodeCave wrote: patch tokenizer offset_separator implementation While patches to implementations are appreciated, it would also be helpful if you submitted a patch for the appropriate regression test that tested the issue being fixed. This is particularly true for older libraries where someone other than the original author may have to apply the patch. Supplying a test case increases confidence that the patch is correct. Thanks, --Beman

79a80,109
// Test return partial - WORKS { const string test_string = "aaabbbc"; string answer[] = {"aaa","bbb"}; typedef token_iterator_generator<offset_separator>::type Iter; boost::array<int,3> offsets = {{3,3,3}}; offset_separator func(offsets.begin(),offsets.end(),false,false); Iter begin = make_token_iterator<string>(test_string.begin(), test_string.end(),func); Iter end= make_token_iterator<string>(test_string.end(), test_string.end(),func); BOOST_REQUIRE(equal(begin,end,answer));
}
// Test return partial - SHOULD WORK in patched version { const string test_string = "aaabbbcc"; string answer[] = {"aaa","bbb"}; typedef token_iterator_generator<offset_separator>::type Iter; boost::array<int,3> offsets = {{3,3,3}}; offset_separator func(offsets.begin(),offsets.end(),false,false); Iter begin = make_token_iterator<string>(test_string.begin(), test_string.end(),func); Iter end= make_token_iterator<string>(test_string.end(), test_string.end(),func); BOOST_REQUIRE(equal(begin,end,answer));
}
participants (2)
-
Beman Dawes
-
CodeCave