Class RectanglesPlacementTest
Test Suite for Optimal Rectangles Placement
Validates the Branch and Bound algorithm's ability to optimally pack 2D shapes. Employs testing assertions to verify spatial optimization and constraint enforcement (such as boundary limits and adjacency rules).
- 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: 6 assorted pieces evaluated on a 5x5 grid.(package private) voidScenario: 6 assorted pieces evaluated on a larger 8x8 grid.(package private) voidScenario: 3 assorted pieces evaluated on a 5x5 grid.(package private) voidScenario: 2 assorted pieces evaluated on a 5x5 grid.(package private) voidScenario: Multithreaded evaluation of 6 pieces on an 8x8 grid.(package private) voidScenario: Pieces that physically exceed the geometric limits of a 2x2 board.(package private) static voidteardown()Cleans up resources after the entire test suite has finished execution.
-
Constructor Details
-
RectanglesPlacementTest
RectanglesPlacementTest()
-
-
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. -
shouldFindOptimalAreaForSixPiecesOn5x5Board
@Test void shouldFindOptimalAreaForSixPiecesOn5x5Board()Scenario: 6 assorted pieces evaluated on a 5x5 grid.
Expected Outcome: The algorithm successfully packs the pieces, yielding a minimal bounding box area of exactly 25.
-
shouldFindOptimalAreaForThreePiecesOn5x5Board
@Test void shouldFindOptimalAreaForThreePiecesOn5x5Board()Scenario: 3 assorted pieces evaluated on a 5x5 grid.
Expected Outcome: The algorithm compacts the pieces into a subset of the board, yielding a minimal bounding box area of exactly 9.
-
shouldFindOptimalAreaForTwoPiecesOn5x5Board
@Test void shouldFindOptimalAreaForTwoPiecesOn5x5Board()Scenario: 2 assorted pieces evaluated on a 5x5 grid.
Expected Outcome: The pieces are tightly adjacent, yielding a bounding box area of exactly 4.
-
shouldRejectPlacementWhenInsufficientSpaceExists
@Test void shouldRejectPlacementWhenInsufficientSpaceExists()Scenario: Pieces that physically exceed the geometric limits of a 2x2 board.
Expected Outcome: The constraints strictly reject placement. The tree is heavily pruned, and no valid final node is established.
-
shouldFindOptimalAreaForSixPiecesOn8x8Board
@Test void shouldFindOptimalAreaForSixPiecesOn8x8Board()Scenario: 6 assorted pieces evaluated on a larger 8x8 grid.
Expected Outcome: The algorithm successfully packs the pieces, discovering a tighter optimal area of exactly 24 due to expanded rotational freedom.
-
shouldFindOptimalAreaUsingConcurrentBranchAndBound
@Test void shouldFindOptimalAreaUsingConcurrentBranchAndBound()Scenario: Multithreaded evaluation of 6 pieces on an 8x8 grid.
Expected Outcome: The concurrent framework identically packs the pieces, achieving the same minimal area of 24.
-