-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLexiconTrieTest.java
47 lines (41 loc) · 1.17 KB
/
LexiconTrieTest.java
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
43
44
45
46
47
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import junit.framework.TestCase;
public class LexiconTrieTest extends TestCase {
/* TODO: Write extensive test cases for EVERY non-trivial piece of code.
* Private helper methods should have associated public static tester methods
* in WordOnBoardFinder.java. */
/**
* Your test dictionary, containing words in smalltestwords.txt
*/
private Scanner words;
/**
* Open smalltestwords.txt and give to the words instance variable. This is
* automatically run before each test.
*/
public void setUp() {
try {
words = new Scanner(new File("src/smalltestwords.txt"));
} catch (FileNotFoundException e) {
System.out.println(e);
assertTrue(false);
}
}
/**
* Closes smalltestwords.txt after each test.
*/
public void tearDown() {
words.close();
}
/**
* A basic test for the lexicon. You should not assume that passing this test
* means that your code works.
*/
public void testLexicon() {
LexiconTrie l = new LexiconTrie();
l.load(words);
assertTrue(l.contains("gorilla"));
assertFalse(l.contains("armin"));
}
}