Subject: | [PATCH] test the features and bug RT#11243 |
Please add the attached test case and apply the patches for the 2
outstanding bugs.
https://rt.cpan.org/Public/Bug/Display.html?id=11243
https://rt.cpan.org/Public/Bug/Display.html?id=11256
--
Reini Urban
Subject: | test_string.t |
#! perl
use Test;
BEGIN { plan tests => 6, todo => [6] }
use SuffixTree;
my $str = "mississippi is long river";
my $tree = create_tree($str);
# print_tree($tree);
ok (find_substring($tree, "ssis") == 3);
ok (find_substring($tree, "pp") == 9);
ok (find_substring($tree, "ss") == 3);
ok (find_substring($tree, "ss") == 3);
ok (find_substring($tree, "sss") > length($str)); # len + 10 actually
# https://rt.cpan.org/Public/Bug/Display.html?id=11243
my $str2 = "x";
# this will redefine ST_ERROR and confuse suffex_tree.c:
my $tree2 = create_tree($str2);
$query = "Missouri river";
ok (find_substring($tree, $query) > length($str)); # TODO
delete_tree($tree);
delete_tree($tree2);