Advertisement
jdalbey

WordsearchSolver Unit Test

Jan 7th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. public class WordSearchSolverTest extends junit.framework.TestCase
  3. {
  4.     private char board[][];
  5.     private ArrayList<String> wordlist;
  6.  
  7.     public WordSearchSolverTest()
  8.     {
  9.     }
  10.  
  11.     /**
  12.      * Sets up the test fixture.
  13.      *
  14.      * Called before every test case method.
  15.      */
  16.     protected void setUp()
  17.     {
  18.         wordlist = new ArrayList<String>();
  19.     }
  20.  
  21.     public void testOneHorizontal()
  22.     {
  23.         char [][] board = { {'X', 'X','X','X'},
  24.                             {'X', 'C','A','T'},
  25.                             {'X', 'X','X','X'},
  26.                             {'X', 'X','X','X'}};
  27.         wordlist.add("CAT");
  28.         WordSearchSolver ws = new WordSearchSolver(3, board, wordlist);
  29.         ArrayList<PuzzleWord> results = ws.findwords();
  30.         assertEquals("wrong number of results",1,results.size());
  31.     }
  32.    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement