Пример #1
0
 @Test
 public void testMakeInitialArray() {
   int[] indexArray = search.makeIndexArray();
   boolean ok = true;
   for (int i = 0; i < indexArray.length; i++) {
     ok = ok && (indexArray[i] == -1);
   }
   Assert.assertTrue(ok);
 }
Пример #2
0
 @Test
 public void testMakeTestPhrase() {
   int[] indexArray = search.makeIndexArray();
   wordlist.addWord("this");
   wordlist.addWord("isa");
   wordlist.addWord("test");
   indexArray[0] = 0;
   indexArray[1] = 1;
   indexArray[2] = 2;
   String phrase = search.makePhrase(indexArray);
   Assert.assertEquals("this isa test", phrase);
 }
Пример #3
0
 @Test
 public void testMatching() throws NoSuchAlgorithmException {
   search.setMatcher(new MatcherForMd5(matchingMd5));
   int[] indexArray = search.makeIndexArray();
   wordlist.addWord("poultry");
   wordlist.addWord("outwits");
   wordlist.addWord("ants");
   indexArray[0] = 0;
   indexArray[1] = 1;
   indexArray[2] = 2;
   String probe = testPhrase.replace(" ", "");
   Assert.assertEquals(testPhrase, search.makePhrase(indexArray));
   Assert.assertTrue(search.matching(probe, indexArray));
 }
Пример #4
0
 @Test
 public void testMakeEmptyPhrase() {
   int[] indexArray = search.makeIndexArray();
   String phrase = search.makePhrase(indexArray);
   Assert.assertEquals("", phrase);
 }