-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrieStructureTest.java
More file actions
42 lines (31 loc) · 839 Bytes
/
Copy pathTrieStructureTest.java
File metadata and controls
42 lines (31 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TrieStructureTest
{
@Before
public void setUp() throws Exception
{
}
@After
public void tearDown() throws Exception
{
}
@Test
public void testPutWord()
{
TrieStructure x = new TrieStructure();
assertTrue(x.putWord("chuka", 25));
assertTrue(x.putWord("cab", 30));
assertTrue(x.putWord("0chuka", 10));
assertTrue(x.putWord("xylophone", 17));
assertTrue(x.putWord("random", 1000));
assertTrue(x.putWord("a", 70));
assertTrue(x.getWordIndexes("chuka").contains(25));
assertTrue(x.getWordIndexes("xylophone").contains(17));
assertTrue(x.getWordIndexes("rabbit") == null);
assertFalse(x.putWord("-", 21));
assertFalse(x.putWord(null, 42)); //Should never happen
}
}