35 typedef jau::lang::token_fsm<uint16_t> token_fsm_u17;
37 std::vector<token_fsm_u17::token_value_t> tkey_words = {
46 fprintf(stderr,
"token: %s\n", token.fsm_to_string(26).c_str());
47 fprintf(stderr,
"token: %s\n", token.to_string().c_str());
48 REQUIRE(
false == token.empty() );
49 REQUIRE( 5 == token.count() );
51 REQUIRE(
true == token.add( { 6,
"heaven" } ) );
52 REQUIRE( 6 == token.count() );
53 REQUIRE(
false == token.empty() );
55 for(
size_t count=0; count < tkey_words.size(); ++count) {
56 token_fsm_u17::uint_t res = token.get(tkey_words[count].value);
57 fprintf(stderr,
"%2zu: %s -> %zu (token)\n", count, std::string(tkey_words[count].value).c_str(), (
size_t)res);
58 REQUIRE( tkey_words[count].name == res );
60 REQUIRE( 6 == token.get(
"heaven") );
62 std::string haystack =
"012345 hello aa";
63 token_fsm_u17::result_t res = token.find(haystack);
64 fprintf(stderr,
"find '%s' -> %s\n", haystack.c_str(), res.to_string().c_str());
65 REQUIRE( tkey_words[4].name == res.token_name );
66 REQUIRE( 7 == res.source_begin );
67 REQUIRE( 12 == res.source_last );
70 std::string haystack =
"012345 hello";
71 token_fsm_u17::result_t res = token.find(haystack);
72 fprintf(stderr,
"find '%s' -> %s\n", haystack.c_str(), res.to_string().c_str());
73 REQUIRE( tkey_words[4].name == res.token_name );
74 REQUIRE( 7 == res.source_begin );
75 REQUIRE( 12 == res.source_last );
80 std::vector<std::string_view> skey_words = {
179 typedef jau::lang::token_fsm<uint16_t> token_fsm_u17;
181 std::vector<token_fsm_u17::token_value_t> tkey_words;
182 for(
size_t i=0; i<skey_words.size(); ++i ) {
183 tkey_words.push_back( {
static_cast<token_fsm_u17::uint_t
>( i+1 ) , skey_words[i] } );
188 fprintf(stderr,
"cpp_token: %s\n", token.to_string().c_str());
189 REQUIRE(
false == token.empty() );
191 for(
size_t count=0; count < tkey_words.size(); ++count) {
192 token_fsm_u17::uint_t res = token.get(tkey_words[count].value);
193 fprintf(stderr,
"%2zu: %s -> %zu (token)\n", count, std::string(tkey_words[count].value).c_str(), (
size_t)res);
194 REQUIRE( tkey_words[count].name == res );
Case insensitive ASCII base 26 alphabet with ASCII code-point sorting order.
Case insensitive ASCII base 69 alphabet with ASCII code-point sorting order.
METHOD_AS_TEST_CASE(test00_hello, "00_hello")