/** Test of legalMove method, of class TowerOfHanoi. */ @Test public void testLegalMove() { System.out.println("legalMove"); // a -> c TowerOfHanoi instance = new TowerOfHanoi(this.discs3); instance.legalMove(0, 2); TowerOfHanoi expResult = new TowerOfHanoi(new int[] {3, 2}); expResult.setTower2(new int[] {1}); assertEquals(expResult, instance); // a -> b instance.legalMove(0, 1); expResult.setTower0(new int[] {3}); expResult.setTower1(new int[] {2}); assertEquals(expResult, instance); // b <- c instance.legalMove(1, 2); expResult.setTower1(new int[] {2, 1}); expResult.setTower2(new int[] {}); assertEquals(expResult, instance); }
/** Test of moveFromXToY method, of class TowerOfHanoi. */ @Test public void testMoveLeftToRight() { System.out.println("moveFromXToY"); TowerOfHanoi instance = new TowerOfHanoi(this.discs3); instance.moveFromXToY(0, 1); TowerOfHanoi expResult = new TowerOfHanoi(new int[] {3, 2}); expResult.setTower1(new int[] {1}); assertEquals(expResult, instance); // instance = new TowerOfHanoi(this.discs3); instance.moveFromXToY(0, 1); instance.moveFromXToY(0, 2); instance.moveFromXToY(1, 0); expResult = new TowerOfHanoi(new int[] {3, 1}); expResult.setTower2(new int[] {2}); assertEquals(expResult, instance); }