From 43d683c782addcbadbe4988e493cc27c91810bc7 Mon Sep 17 00:00:00 2001 From: olim Date: Wed, 31 Jan 2024 15:46:34 +0000 Subject: add tests add tests for the maps location transformation function and the location manager valid location and LocaitonMessage functions --- .../skyblock/dwarven/CrystalsHudTest.java | 19 +++++++++++++ .../dwarven/CrystalsLocationManagerTest.java | 31 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudTest.java create mode 100644 src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationManagerTest.java (limited to 'src/test/java/de/hysky/skyblocker/skyblock/dwarven') 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..3086a3e4 --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudTest.java @@ -0,0 +1,19 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import it.unimi.dsi.fastutil.Pair; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class CrystalsHudTest { + + @Test + void testLocationTransformation(){ + Assertions.assertEquals(CrystalsHud.transformLocation(202,202), Pair.of(0,0)); + Assertions.assertEquals(CrystalsHud.transformLocation(823,823), Pair.of(62,62)); + + Assertions.assertEquals(CrystalsHud.transformLocation(512.5,512.5), Pair.of(31,31)); + + Assertions.assertEquals(CrystalsHud.transformLocation(-50,-50), Pair.of(0,0)); + Assertions.assertEquals(CrystalsHud.transformLocation(1000,1000), Pair.of(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..592e5ecb --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationManagerTest.java @@ -0,0 +1,31 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import net.minecraft.text.Text; +import net.minecraft.util.math.BlockPos; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +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(), "Added waypoint for Jungle Temple at : 10 11 12."); + Assertions.assertEquals(CrystalsLocationsManager.getSetLocationMessage("Fairy Grotto",new BlockPos(0,0,0)).getString(), "Added waypoint for Fairy Grotto at : 0 0 0."); + } +} -- cgit