
- Introduced tiered island network generation. - Enhanced player/team-specific world spawning. - Refactored persistent data usage for key workflows. - Added unit tests for circle placement logic.
57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package com.ncguy.usefulskyblock;
|
|
|
|
import com.ncguy.usefulskyblock.utils.MathsUtils;
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class SimpleTests {
|
|
|
|
public static class Datum {
|
|
public int count;
|
|
public int ring;
|
|
public int slot;
|
|
|
|
public Datum(int count, int ring, int slot) {
|
|
this.count = count;
|
|
this.ring = ring;
|
|
this.slot = slot;
|
|
}
|
|
}
|
|
|
|
@Test
|
|
public void testCirclePlacement() {
|
|
Datum[] data = new Datum[] {
|
|
new Datum(0, 0, 0),
|
|
new Datum(1, 1, 0),
|
|
new Datum(2, 1, 1),
|
|
new Datum(3, 1, 2),
|
|
new Datum(4, 1, 3),
|
|
new Datum(5, 2, 0),
|
|
new Datum(6, 2, 1),
|
|
new Datum(7, 2, 2),
|
|
new Datum(8, 2, 3),
|
|
new Datum(9, 2, 4),
|
|
new Datum(10, 2, 5),
|
|
new Datum(11, 2, 6),
|
|
new Datum(12, 2, 7),
|
|
};
|
|
|
|
for(int i = 0; i < data.length; i++) {
|
|
Datum datum = data[i];
|
|
int count = datum.count;
|
|
int ring = MathsUtils.getRing(count);
|
|
int slot = MathsUtils.getSlot(count);
|
|
|
|
System.out.printf("Count: %d, Ring: %d, Slot: %d\n", count, ring, slot);
|
|
Assertions.assertEquals(datum.ring, ring);
|
|
Assertions.assertEquals(datum.slot, slot);
|
|
}
|
|
|
|
}
|
|
|
|
@Test
|
|
public void t() {
|
|
Assertions.assertEquals(1, Integer.highestOneBit(1));
|
|
}
|
|
|
|
}
|