Libraryless. Click here for Pure Java version (3091L/19K).
1 | svoid test_StringTrie() { |
2 | Map<S, Int> map = littreemap("hello" := 1, "hella" := 2); |
3 | StringTrie<Int> trie = asStringTrie(map); |
4 | assertEquals(map, trie.asMap()); |
5 | print(trie); |
6 | assertEquals(littreeset("hell"), trie.childStrings()); |
7 | |
8 | // add in different order, check again |
9 | trie = new StringTrie; |
10 | trie.add("hello" := 1); |
11 | trie.add("hella" := 2); |
12 | assertEquals(map, trie.asMap()); |
13 | print(trie); |
14 | assertEquals(littreeset("hell"), trie.childStrings()); |
15 | |
16 | map.put("hell" := 3); |
17 | assertEquals(map, asStringTrie(map).asMap()); |
18 | |
19 | map = litcimap("HE" := 1, "hello" := 2); |
20 | assertEquals(map, assertCIMap(asStringTrie(map).asMap())); |
21 | print(asStringTrie(map)); |
22 | |
23 | map = litmap("" := 5, "bla" := 6); |
24 | assertEquals(map, asStringTrie(map).asMap()); |
25 | print(asStringTrie(map)); |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030156 |
Snippet name: | test_StringTrie [OK] |
Eternal ID of this version: | #1030156/11 |
Text MD5: | 9bbb5b439b8dcca135c41f7e526e2522 |
Transpilation MD5: | 77bdcf18094934dac5d275b950110987 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-11 22:28:35 |
Source code size: | 819 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 194 / 331 |
Version history: | 10 change(s) |
Referenced in: | [show references] |