## TODO XXX need MORE tests to check failures, not just succeses plan(103); ok(!nqp::eqatic('b', 'bb', 0), "MVM index/eqatic bug"); ok(!nqp::eqatic('st', 'sta', 0)); ok(!nqp::eqatic('st', 'stassssssss', 0)); ok(!nqp::eqatic('st', 'stassssssss', 0)); ok( nqp::eqatic('aBcdef', 'bcd', 1)); # With ligatures that expand under casefolding ok( nqp::eqatic('aastaa', 'st', 2) ); ok( nqp::eqatic('aastaa', 'st', 2) ); ok( nqp::eqatic('aastaa', 'st', 2) ); ok( nqp::eqatic('aastaaz', 'z', 5) ); ok( nqp::eqatic('aastzaa', 'z', 3) ); ok( nqp::eqatic('aaast', 'st', 3) ); ok( nqp::eqatic('staaa', 'st', 0) ); ok( nqp::eqatic('st', 'st', 0) ); ok( nqp::eqatic('st', 'st', 0) ); ok( nqp::eqatic('aaaast', 'st', 4) ); ok( nqp::eqatic('AAAAst', 'st', 4) ); test-it('st', 'st', 20, 1); test-it('st', 'st', 20, 0); test-it('st', 'st', 20, 1); test-it('st', 'st', 20, 0); # Without codepoint which expand when casefolded for (0,1,2,3,4,5,6) -> $val { my str $letter := nqp::chr($val + nqp::ord('A')); ok( nqp::eqatic('ABCDEFG', $letter, $val), "nqp::eqatic(\$needle, '$letter', $val)"); } sub test-it ($needle, $text, $max, $opt) { my int $i := 0; while ($i < $max) { my str $str := nqp::x('a', $max - $i); $str := $str ~ $text; $str := $str ~ nqp::x('b', $i) if $opt; ok( nqp::eqatic($str, $needle, $max - $i), "eqatic haystack = '$str' needle = '$needle' $i"); $i++ } }