import java.util.ArrayList;

/**
 * This class tests for a few common object design mistakes for A04.
 * Prints tests and results to the screen.  Requires these room files
 * to be in the same directory:
 * <ul>
 * <li>cul-de-sac.txt
 * <li>roundNround.txt
 * </ul>
 *
 * @version 2
 */
 public class A04Tester {

   public static void main(String[] args) throws java.io.IOException {
     //NOTE: do a search and replace: Ztomasze to your Username

     String map1 = "cul-de-sac.txt";
     String map2 = "roundNround.txt";
     ZtomaszeA04 room1 = new ZtomaszeA04(map1);
     ZtomaszeA04 room2 = new ZtomaszeA04(map2);

     //getting paths without calling toString() first
     ArrayList<Direction> path1 = room1.getPathToExit();
     ArrayList<Direction> path2 = room2.getPathToExit();

     //paths for different rooms with valid paths are different?
     //(Most common reason for this test to fail is that you are using
     // static variables rather than instance variables, though there
     // may be other causes too)
     System.out.println("Path for " + map1 + ": " + path1);
     System.out.println("Path for " + map2 + ": " + path2);
     System.out.print("Two paths are different: ");
     System.out.println((path1.equals(path2)) ? "FAIL" : "PASS");
     System.out.println("(Not tested: whether these paths are actually correct for their room.)");
     System.out.println();

     //did not call toString() first
     System.out.println("Path for " + map1 + ": " + path1);
     ArrayList<Direction> repeated = room1.getPathToExit();
     System.out.println("Repeated call: " + repeated);
     System.out.print("Same path returned each time: ");
     System.out.println((path1.equals(repeated)) ? "PASS" : "FAIL");
     System.out.println("(Note: This is optional. While a well-designed class would support this,");
     System.out.println("Tamarin will not actually run this test.  If you want to support it, see");
     System.out.println("the A04 FAQ about saving the path rather than recalculating it each time.)");
   }
 }