Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannetty committed Sep 19, 2024
1 parent 62fdbe3 commit 21ec3e0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/arcade/potts/env/location/PottsLocationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,8 @@ public void split_withOffsetsAndCustomProbability_callsPerformSplitWithCustomPro
);
spy.split(randomDoubleZero, offsets, null, customSplitProbability);
verify(spy).getSplitpoint(offsets);
verify(spy).performSplit(eq(randomDoubleZero), Mockito.any(Voxel.class), eq(null), eq(false), eq(customSplitProbability));
verify(spy).performSplit(eq(randomDoubleZero), Mockito.any(Voxel.class),
eq(null), eq(false), eq(customSplitProbability));
}

@Test
Expand Down Expand Up @@ -1404,7 +1405,8 @@ public void split_withOffsetsDirectionAndCustomProbability_callsPerformSplitWith

spy.split(randomDoubleZero, offsets, customDirection, customSplitProbability);
verify(spy).getSplitpoint(offsets);
verify(spy).performSplit(eq(randomDoubleZero), Mockito.any(Voxel.class), eq(customDirection), eq(false), eq(customSplitProbability));
verify(spy).performSplit(eq(randomDoubleZero), Mockito.any(Voxel.class), eq(customDirection),
eq(false), eq(customSplitProbability));
}

@Test
Expand Down Expand Up @@ -1563,15 +1565,17 @@ public void performSplit_withCustomProbabilityAndOffset_splitsBasedOnProbability

// Mock random to return a value less than customProbability (expecting voxelsA to be kept)
when(random.nextDouble()).thenReturn(0.75); // This should trigger the voxelsA to be returned
PottsLocation splitLocation = (PottsLocation) location.performSplit(random, splitpoint, direction, false, customProbability);
PottsLocation splitLocation = (PottsLocation) location.performSplit(random, splitpoint, direction,
false, customProbability);

// Assert the number of voxels in location is larger than splitLocation due to 90% offset
assertTrue(location.voxels.size() > splitLocation.voxels.size());

// Mock random to return a value greater than customProbability (expecting voxelsB to be kept)
when(random.nextDouble()).thenReturn(0.85); // This should trigger the voxelsB to be returned
PottsLocation newLocation = new PottsLocationMock(voxelListAB);
PottsLocation newSplitLocation = (PottsLocation) newLocation.performSplit(random, splitpoint, direction, false, customProbability);
PottsLocation newSplitLocation = (PottsLocation) newLocation.performSplit(random, splitpoint, direction,
false, customProbability);

// Assert the number of voxels in newLocation is smaller than newSplitLocation
assertTrue(newLocation.voxels.size() < newSplitLocation.voxels.size());
Expand All @@ -1588,7 +1592,9 @@ public void performSplit_withoutDirectionOrBalancing_splitsWithoutBalancing() {
Voxel splitpoint = location.getSplitpoint();

// Perform the split without a direction and without balancing
PottsLocation splitLocation = (PottsLocation) location.performSplit(random, splitpoint, null, false, PottsLocation.DEFAULT_SPLIT_PROBABILITY);
PottsLocation splitLocation = (PottsLocation) location.performSplit(random, splitpoint, null,
false,
PottsLocation.DEFAULT_SPLIT_PROBABILITY);

assertNotNull(splitLocation);
assertTrue(location.voxels.size() > 0);
Expand Down

0 comments on commit 21ec3e0

Please sign in to comment.