Skip to content

Commit

Permalink
added split test using zx direction to test split functionality in z …
Browse files Browse the repository at this point in the history
…plane
  • Loading branch information
Jannetty committed Sep 25, 2024
1 parent 5de8f5c commit 65c98d1
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion test/arcade/potts/env/location/PottsLocationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ public void split_withOffsetsWithDirection_callsMethods() {
}

@Test
public void split_withOffsetsWithDirectionWithProbability_splitsVoxelsCorrectly() {
public void split_withOffsetsWithXYDirectionWithProbability_splitsVoxelsCorrectly() {
ArrayList<Voxel> voxels = new ArrayList<>();

for (int i = 0; i < 3; i++) {
Expand Down Expand Up @@ -1355,4 +1355,39 @@ public void split_withOffsetsWithDirectionWithProbability_splitsVoxelsCorrectly(
assertEquals(locVoxels, loc.voxels);
assertEquals(splitVoxels, split.voxels);
}

@Test
public void split_withOffsetsWithZXDirectionWithProbability_splitsVoxelsCorrectly() {
ArrayList<Voxel> voxels = new ArrayList<>();

for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
voxels.add(new Voxel(i, j, k));
}
}
}

ArrayList<Voxel> splitVoxels = new ArrayList<>();
splitVoxels.add(new Voxel(0, 0, 2));
splitVoxels.add(new Voxel(0, 1, 2));
splitVoxels.add(new Voxel(0, 2, 2));
ArrayList<Voxel> locVoxels = new ArrayList<>(voxels);
locVoxels.removeAll(splitVoxels);

PottsLocation loc = new PottsLocationMock(voxels);
Direction direction = Direction.POSITIVE_ZX;
double probability = 0.0;

ArrayList<Integer> offsets = new ArrayList<>(Arrays.asList(0, 100, 50));
PottsLocation split = (PottsLocation) loc.split(randomDoubleZero, offsets, direction, probability);

locVoxels.sort(VOXEL_COMPARATOR);
loc.voxels.sort(VOXEL_COMPARATOR);
splitVoxels.sort(VOXEL_COMPARATOR);
split.voxels.sort(VOXEL_COMPARATOR);

assertEquals(locVoxels, loc.voxels);
assertEquals(splitVoxels, split.voxels);
}
}

0 comments on commit 65c98d1

Please sign in to comment.