Class EightPuzzleTest
Test Suite for the 8-Puzzle Solver
Validates the resolution algorithms, state pruning mechanisms, and bounding heuristics across solvable and mathematically unsolvable board configurations.
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidsetup()Initializes context and resources prior to executing the test suite.(package private) voidScenario: A board that is inherently in the target state.(package private) voidScenario: A mathematically scrambled board containing an odd inversion parity, making it unsolvable.(package private) voidScenario: A moderately scrambled board configuration.(package private) voidScenario: A highly scrambled board configuration.(package private) static voidteardown()Cleans up resources after the entire test suite has finished execution.
-
Constructor Details
-
EightPuzzleTest
EightPuzzleTest()
-
-
Method Details
-
setup
@BeforeAll static void setup()Initializes context and resources prior to executing the test suite. -
teardown
@AfterAll static void teardown()Cleans up resources after the entire test suite has finished execution. -
shouldSolvePuzzleUsingManhattanHeuristic
@Test void shouldSolvePuzzleUsingManhattanHeuristic()Scenario: A moderately scrambled board configuration.
Expected Outcome: The Branch and Bound algorithm utilizing the Manhattan distance heuristic must locate the final configuration (heuristic = 0).
-
shouldSolvePuzzleUsingMisplacedTilesHeuristic
@Test void shouldSolvePuzzleUsingMisplacedTilesHeuristic()Scenario: A highly scrambled board configuration.
Expected Outcome: The Branch and Bound algorithm utilizing the Misplaced Tiles heuristic must successfully locate the final configuration.
-
shouldIdentifyAlreadySolvedPuzzle
@Test void shouldIdentifyAlreadySolvedPuzzle()Scenario: A board that is inherently in the target state.
Expected Outcome: The algorithm must immediately identify the target geometry and return the baseline heuristic without further evaluation.
-
shouldRejectUnsolvablePuzzleBoard
@Test void shouldRejectUnsolvablePuzzleBoard()Scenario: A mathematically scrambled board containing an odd inversion parity, making it unsolvable.
Expected Outcome: The pruning function must discard the entire execution tree. Attempting to extract the best node subsequently triggers a Null Pointer Exception.
-