Move lybrinthine iterative deepening test to correct test class

This commit is contained in:
Niklas Birk 2021-04-13 17:28:23 +02:00
parent 54eba4aa35
commit a3a344e057
2 changed files with 27 additions and 26 deletions

View File

@ -120,28 +120,4 @@ class LabyrinthineNodeTest
Assertions.assertArrayEquals(targetSuccessor2, successors.get(1).getValue()); Assertions.assertArrayEquals(targetSuccessor2, successors.get(1).getValue());
Assertions.assertArrayEquals(targetSuccessor3, successors.get(2).getValue()); Assertions.assertArrayEquals(targetSuccessor3, successors.get(2).getValue());
} }
@Test
void shouldReturnCorrectTarget()
{
final boolean[][] state = {
{true, false, true},
{false, true, false},
{true, false, true}
};
final var root = new LabyrinthineNode(state);
final boolean[][] targetState = {
{true, true, true},
{true, true, true},
{true, true, true},
};
final var expected = new LabyrinthineNode(targetState);
final var actual = new IterativeDeepening().iterativeDeepening(root, expected);
printSolution(actual);
}
} }

View File

@ -2,13 +2,14 @@ package search.uninformed.iterativedeepening;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import search.EightPuzzleNode; import search.EightPuzzleNode;
import search.LabyrinthineNode;
import static search.SearchTestUtils.printSolution; import static search.SearchTestUtils.printSolution;
class IterativeDeepeningTest class IterativeDeepeningTest
{ {
@Test @Test
void shouldReturnCorrectTarget() void shouldReturnCorrectTargetEightPuzzle()
{ {
final int[][] state = { final int[][] state = {
{5, 0, 3}, {5, 0, 3},
@ -30,7 +31,7 @@ class IterativeDeepeningTest
} }
@Test @Test
void shouldReturnCorrectTargetCubekNode() void shouldReturnCorrectTargetCubekNodeEightPuzzle()
{ {
final int[][] state = { final int[][] state = {
{2, 0, 4}, {2, 0, 4},
@ -50,4 +51,28 @@ class IterativeDeepeningTest
printSolution(actual); printSolution(actual);
} }
@Test
void shouldReturnCorrectTargetLabyrinthine()
{
final boolean[][] state = {
{true, false, true},
{false, true, false},
{true, false, true}
};
final var root = new LabyrinthineNode(state);
final boolean[][] targetState = {
{true, true, true},
{true, true, true},
{true, true, true},
};
final var expected = new LabyrinthineNode(targetState);
final var actual = new IterativeDeepening().iterativeDeepening(root, expected);
printSolution(actual);
}
} }