Class ChessQueensOneTest
java.lang.Object
topics.backtracking.nqueens.ChessQueensOneTest
Test Suite for ChessQueensOne
Validates the early-exit backtracking algorithm for the N-Queens problem. Employs assertions to verify the presence or absence of a valid combinatorial arrangement across various board dimensions.
- 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 4x4 chessboard.(package private) voidScenario: A 3x3 chessboard.(package private) static voidteardown()Cleans up resources after the entire test suite has finished execution.
-
Constructor Details
-
ChessQueensOneTest
ChessQueensOneTest()
-
-
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. -
shouldLocateSolutionOn4x4Board
@Test void shouldLocateSolutionOn4x4Board()Scenario: A 4x4 chessboard.
Expected Outcome: The algorithm must quickly locate a valid non-threatening arrangement and return
true. -
shouldNotFindSolutionOn3x3Board
@Test void shouldNotFindSolutionOn3x3Board()Scenario: A 3x3 chessboard.
Expected Outcome: It is geometrically impossible to place 3 non-threatening queens on a 3x3 board. The algorithm must exhaust the state space and correctly return
false.
-