Uses 14K of libraries. Click here for Pure Java version (3609L/23K).
1 | lib 1400378 |
2 | |
3 | import com.abahgat.suffixtree.*; |
4 | |
5 | svoid test_GeneralizedSuffixTree() {
|
6 | new GeneralizedSuffixTree in; |
7 | |
8 | String word = "cacao"; |
9 | in.put(word, 0); |
10 | |
11 | /* test that every substring is contained within the tree */ |
12 | for (String s : allSubstringsWithoutEmpty(word)) {
|
13 | assertTrue(in.search(s).contains(0)); |
14 | } |
15 | assertEmpty(in.search("caco"));
|
16 | assertEmpty(in.search("cacaoo"));
|
17 | assertEmpty(in.search("ccacao"));
|
18 | |
19 | in = new GeneralizedSuffixTree(); |
20 | word = "bookkeeper"; |
21 | in.put(word, 0); |
22 | for (String s : allSubstringsWithoutEmpty(word)) {
|
23 | assertTrue(in.search(s).contains(0)); |
24 | } |
25 | assertEmpty(in.search("books"));
|
26 | assertEmpty(in.search("boke"));
|
27 | assertEmpty(in.search("ookepr"));
|
28 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028137 |
| Snippet name: | test_GeneralizedSuffixTree (OK) |
| Eternal ID of this version: | #1028137/2 |
| Text MD5: | 4e3fe0c23a7691bf3cf4de85fe628280 |
| Transpilation MD5: | e9d2fc60efc0a3a512d849cee3d2f0f4 |
| Author: | stefan |
| Category: | javax / text searching |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-23 13:05:26 |
| Source code size: | 747 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 448 / 580 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |