Class ChessHorseOneTest
java.lang.Object
topics.backtracking.knighttour.ChessHorseOneTest
Test Suite for ChessHorseOne
Validates the early-exit backtracking algorithm for the Knight's Tour problem. Employs assertions to verify the presence or absence of a valid path based on varying initial topological conditions.
- 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: Standard 5x5 board starting at the top-left corner.(package private) voidScenario: 5x5 board starting at an edge coordinate (1,4).(package private) static voidteardown()Cleans up resources after the entire test suite has finished execution.
-
Constructor Details
-
ChessHorseOneTest
ChessHorseOneTest()
-
-
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. -
shouldLocateSolutionOnStandard5x5Board
@Test void shouldLocateSolutionOnStandard5x5Board()Scenario: Standard 5x5 board starting at the top-left corner.
Expected Outcome: The algorithm must quickly locate a valid topological path and return
truewithout exploring the entire state space. -
shouldNotFindSolutionFromDeadEndStartingPosition
@Test void shouldNotFindSolutionFromDeadEndStartingPosition()Scenario: 5x5 board starting at an edge coordinate (1,4).
Expected Outcome: Due to mathematical constraints, a knight cannot complete a full tour from this specific starting point. The algorithm must exhaust the feasible state space and correctly return
false.
-