diff options
Diffstat (limited to 'src/test/java')
3 files changed, 65 insertions, 0 deletions
diff --git a/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudTest.java b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudTest.java new file mode 100644 index 00000000..2a3afe9c --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudTest.java @@ -0,0 +1,19 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import org.joml.Vector2i; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class CrystalsHudTest { + + @Test + void testLocationTransformation() { + Assertions.assertEquals(CrystalsHud.transformLocation(202, 202), new Vector2i(0, 0)); + Assertions.assertEquals(CrystalsHud.transformLocation(823, 823), new Vector2i(62, 62)); + + Assertions.assertEquals(CrystalsHud.transformLocation(512.5, 512.5), new Vector2i(31, 31)); + + Assertions.assertEquals(CrystalsHud.transformLocation(-50, -50), new Vector2i(0, 0)); + Assertions.assertEquals(CrystalsHud.transformLocation(1000, 1000), new Vector2i(62, 62)); + } +} diff --git a/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationManagerTest.java b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationManagerTest.java new file mode 100644 index 00000000..4ce61880 --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationManagerTest.java @@ -0,0 +1,32 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import net.minecraft.util.math.BlockPos; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import de.hysky.skyblocker.utils.Constants; + +public class CrystalsLocationManagerTest { + + @Test + void testLocationInCrystals() { + Assertions.assertTrue(CrystalsLocationsManager.checkInCrystals(new BlockPos(512, 70, 512))); + + Assertions.assertTrue(CrystalsLocationsManager.checkInCrystals(new BlockPos(202, 31, 202))); + Assertions.assertTrue(CrystalsLocationsManager.checkInCrystals(new BlockPos(823, 188, 823))); + + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(201, 31, 202))); + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(202, 30, 202))); + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(202, 31, 201))); + + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(824, 188, 823))); + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(823, 189, 823))); + Assertions.assertFalse(CrystalsLocationsManager.checkInCrystals(new BlockPos(823, 188, 824))); + } + + @Test + void testSetLocationMessage() { + Assertions.assertEquals(CrystalsLocationsManager.getSetLocationMessage("Jungle Temple", new BlockPos(10, 11, 12)).getString(), Constants.PREFIX.get().getString() + "Added waypoint for Jungle Temple at : 10 11 12."); + Assertions.assertEquals(CrystalsLocationsManager.getSetLocationMessage("Fairy Grotto", new BlockPos(0, 0, 0)).getString(), Constants.PREFIX.get().getString() + "Added waypoint for Fairy Grotto at : 0 0 0."); + } +} diff --git a/src/test/java/de/hysky/skyblocker/utils/ConstantsTest.java b/src/test/java/de/hysky/skyblocker/utils/ConstantsTest.java new file mode 100644 index 00000000..fe1dac22 --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/utils/ConstantsTest.java @@ -0,0 +1,14 @@ +package de.hysky.skyblocker.utils; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.time.LocalDate; + +public class ConstantsTest { + @Test + void testPrefix() { + LocalDate time = LocalDate.now(); + Assertions.assertEquals("empty[siblings=[literal{[}[style={color=gray}], literal{S}[style={color=#00FF4C}], literal{k}[style={color=#02FA60}], literal{" + (time.getMonthValue() == 4 && time.getDayOfMonth() == 1 ? "i" : "y") + "}[style={color=#04F574}], literal{b}[style={color=#07EF88}], literal{l}[style={color=#09EA9C}], literal{o}[style={color=#0BE5AF}], literal{c}[style={color=#0DE0C3}], literal{k}[style={color=#10DAD7}], literal{e}[style={color=#12D5EB}], literal{r}[style={color=#14D0FF}], literal{] }[style={color=gray}]]]", Constants.PREFIX.get().toString()); + } +} |
