aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/kotlin/util')
-rw-r--r--src/test/kotlin/util/ColorCodeTest.kt100
-rw-r--r--src/test/kotlin/util/TextUtilText.kt10
-rw-r--r--src/test/kotlin/util/math/GChainReconciliationTest.kt4
-rw-r--r--src/test/kotlin/util/skyblock/AbilityUtilsTest.kt32
-rw-r--r--src/test/kotlin/util/skyblock/ItemTypeTest.kt40
-rw-r--r--src/test/kotlin/util/skyblock/SackUtilTest.kt4
6 files changed, 101 insertions, 89 deletions
diff --git a/src/test/kotlin/util/ColorCodeTest.kt b/src/test/kotlin/util/ColorCodeTest.kt
index 949749e..7c581c5 100644
--- a/src/test/kotlin/util/ColorCodeTest.kt
+++ b/src/test/kotlin/util/ColorCodeTest.kt
@@ -1,57 +1,57 @@
package moe.nea.firmament.test.util
-import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.Test
import moe.nea.firmament.util.removeColorCodes
-class ColorCodeTest : AnnotationSpec() {
- @Test
- fun testWhatever() {
- Assertions.assertEquals("", "".removeColorCodes())
- Assertions.assertEquals("", "§".removeColorCodes())
- Assertions.assertEquals("", "§a".removeColorCodes())
- Assertions.assertEquals("ab", "a§ab".removeColorCodes())
- Assertions.assertEquals("ab", "a§ab§§".removeColorCodes())
- Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes())
- Assertions.assertEquals("bc", "§ab§§c".removeColorCodes())
- Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true))
- Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true))
- Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true))
- }
-
- @Test
- fun testEdging() {
- Assertions.assertEquals("", "§".removeColorCodes())
- Assertions.assertEquals("a", "a§".removeColorCodes())
- Assertions.assertEquals("b", "§ab§".removeColorCodes())
- }
-
- @Test
- fun `testDouble§`() {
- Assertions.assertEquals("1", "§§1".removeColorCodes())
- }
-
- @Test
- fun testKeepNonColor() {
- Assertions.assertEquals("§k§l§m§n§o§r", "§k§l§m§f§n§o§r".removeColorCodes(true))
- }
-
- @Test
- fun testPlainString() {
- Assertions.assertEquals("bcdefgp", "bcdefgp".removeColorCodes())
- Assertions.assertEquals("", "".removeColorCodes())
- }
-
- @Test
- fun testSomeNormalTestCases() {
- Assertions.assertEquals(
- "You are not currently in a party.",
- "§r§cYou are not currently in a party.§r".removeColorCodes()
- )
- Assertions.assertEquals(
- "Ancient Necron's Chestplate ✪✪✪✪",
- "§dAncient Necron's Chestplate §6✪§6✪§6✪§6✪".removeColorCodes()
- )
- }
+class ColorCodeTest {
+ @Test
+ fun testWhatever() {
+ Assertions.assertEquals("", "".removeColorCodes())
+ Assertions.assertEquals("", "§".removeColorCodes())
+ Assertions.assertEquals("", "§a".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab§§".removeColorCodes())
+ Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes())
+ Assertions.assertEquals("bc", "§ab§§c".removeColorCodes())
+ Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true))
+ Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true))
+ Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true))
+ }
+
+ @Test
+ fun testEdging() {
+ Assertions.assertEquals("", "§".removeColorCodes())
+ Assertions.assertEquals("a", "a§".removeColorCodes())
+ Assertions.assertEquals("b", "§ab§".removeColorCodes())
+ }
+
+ @Test
+ fun `testDouble§`() {
+ Assertions.assertEquals("1", "§§1".removeColorCodes())
+ }
+
+ @Test
+ fun testKeepNonColor() {
+ Assertions.assertEquals("§k§l§m§n§o§r", "§k§l§m§f§n§o§r".removeColorCodes(true))
+ }
+
+ @Test
+ fun testPlainString() {
+ Assertions.assertEquals("bcdefgp", "bcdefgp".removeColorCodes())
+ Assertions.assertEquals("", "".removeColorCodes())
+ }
+
+ @Test
+ fun testSomeNormalTestCases() {
+ Assertions.assertEquals(
+ "You are not currently in a party.",
+ "§r§cYou are not currently in a party.§r".removeColorCodes()
+ )
+ Assertions.assertEquals(
+ "Ancient Necron's Chestplate ✪✪✪✪",
+ "§dAncient Necron's Chestplate §6✪§6✪§6✪§6✪".removeColorCodes()
+ )
+ }
}
diff --git a/src/test/kotlin/util/TextUtilText.kt b/src/test/kotlin/util/TextUtilText.kt
index 46ed3b4..94ab222 100644
--- a/src/test/kotlin/util/TextUtilText.kt
+++ b/src/test/kotlin/util/TextUtilText.kt
@@ -1,16 +1,18 @@
package moe.nea.firmament.test.util
-import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.getLegacyFormatString
-class TextUtilText : AnnotationSpec() {
+class TextUtilText {
@Test
fun testThing() {
// TODO: add more tests that are directly validated with 1.8.9 code
val text = ItemResources.loadText("all-chat")
- Assertions.assertEquals("§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r",
- text.getLegacyFormatString())
+ Assertions.assertEquals(
+ "§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r",
+ text.getLegacyFormatString()
+ )
}
}
diff --git a/src/test/kotlin/util/math/GChainReconciliationTest.kt b/src/test/kotlin/util/math/GChainReconciliationTest.kt
index 502bd9e..380ea5c 100644
--- a/src/test/kotlin/util/math/GChainReconciliationTest.kt
+++ b/src/test/kotlin/util/math/GChainReconciliationTest.kt
@@ -1,12 +1,12 @@
package moe.nea.firmament.test.util.math
-import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Assertions.*
+import org.junit.jupiter.api.Test
import moe.nea.firmament.util.math.GChainReconciliation
import moe.nea.firmament.util.math.GChainReconciliation.rotated
-class GChainReconciliationTest : AnnotationSpec() {
+class GChainReconciliationTest {
fun <T> assertEqualCycles(
expected: List<T>,
diff --git a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
index 206a357..9d25aad 100644
--- a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
+++ b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
@@ -1,7 +1,7 @@
package moe.nea.firmament.test.util.skyblock
-import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.Test
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
import net.minecraft.text.Text
@@ -9,7 +9,7 @@ import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.AbilityUtils
import moe.nea.firmament.util.unformattedString
-class AbilityUtilsTest : AnnotationSpec() {
+class AbilityUtilsTest {
fun List<AbilityUtils.ItemAbility>.stripDescriptions() = map {
it.copy(descriptionLines = it.descriptionLines.map { Text.literal(it.unformattedString) })
@@ -24,9 +24,11 @@ class AbilityUtilsTest : AnnotationSpec() {
false,
AbilityUtils.AbilityActivation.RIGHT_CLICK,
null,
- listOf("Throw your pickaxe to create an",
- "explosion mining all ores in a 3 block",
- "radius.").map(Text::literal),
+ listOf(
+ "Throw your pickaxe to create an",
+ "explosion mining all ores in a 3 block",
+ "radius."
+ ).map(Text::literal),
48.seconds
)
),
@@ -43,8 +45,10 @@ class AbilityUtilsTest : AnnotationSpec() {
true,
AbilityUtils.AbilityActivation.RIGHT_CLICK,
null,
- listOf("Grants +200% ⸕ Mining Speed for",
- "10s.").map(Text::literal),
+ listOf(
+ "Grants +200% ⸕ Mining Speed for",
+ "10s."
+ ).map(Text::literal),
2.minutes
)
),
@@ -58,8 +62,10 @@ class AbilityUtilsTest : AnnotationSpec() {
listOf(
AbilityUtils.ItemAbility(
"Instant Transmission", true, AbilityUtils.AbilityActivation.RIGHT_CLICK, 23,
- listOf("Teleport 12 blocks ahead of you and",
- "gain +50 ✦ Speed for 3 seconds.").map(Text::literal),
+ listOf(
+ "Teleport 12 blocks ahead of you and",
+ "gain +50 ✦ Speed for 3 seconds."
+ ).map(Text::literal),
null
),
AbilityUtils.ItemAbility(
@@ -67,9 +73,11 @@ class AbilityUtilsTest : AnnotationSpec() {
false,
AbilityUtils.AbilityActivation.SNEAK_RIGHT_CLICK,
90,
- listOf("Teleport to your targeted block up",
- "to 61 blocks away.",
- "Soulflow Cost: 1").map(Text::literal),
+ listOf(
+ "Teleport to your targeted block up",
+ "to 61 blocks away.",
+ "Soulflow Cost: 1"
+ ).map(Text::literal),
null
)
),
diff --git a/src/test/kotlin/util/skyblock/ItemTypeTest.kt b/src/test/kotlin/util/skyblock/ItemTypeTest.kt
index cca3d13..c0ef2a3 100644
--- a/src/test/kotlin/util/skyblock/ItemTypeTest.kt
+++ b/src/test/kotlin/util/skyblock/ItemTypeTest.kt
@@ -1,26 +1,28 @@
package moe.nea.firmament.test.util.skyblock
-import io.kotest.core.spec.style.ShouldSpec
-import io.kotest.matchers.shouldBe
+import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.DynamicTest
+import org.junit.jupiter.api.TestFactory
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.ItemType
-class ItemTypeTest
- : ShouldSpec(
- {
- context("ItemType.fromItemstack") {
- listOf(
- "pets/lion-item" to ItemType.PET,
- "pets/rabbit-selected" to ItemType.PET,
- "pets/mithril-golem-not-selected" to ItemType.PET,
- "aspect-of-the-void" to ItemType.SWORD,
- "titanium-drill" to ItemType.DRILL,
- "diamond-pickaxe" to ItemType.PICKAXE,
- "gemstone-gauntlet" to ItemType.GAUNTLET,
- ).forEach { (name, typ) ->
- should("return $typ for $name") {
- ItemType.fromItemStack(ItemResources.loadItem(name)) shouldBe typ
- }
+class ItemTypeTest {
+ @TestFactory
+ fun fromItemstack() =
+ listOf(
+ "pets/lion-item" to ItemType.PET,
+ "pets/rabbit-selected" to ItemType.PET,
+ "pets/mithril-golem-not-selected" to ItemType.PET,
+ "aspect-of-the-void" to ItemType.SWORD,
+ "titanium-drill" to ItemType.DRILL,
+ "diamond-pickaxe" to ItemType.PICKAXE,
+ "gemstone-gauntlet" to ItemType.GAUNTLET,
+ ).map { (name, typ) ->
+ DynamicTest.dynamicTest("return $typ for $name") {
+ Assertions.assertEquals(
+ typ,
+ ItemType.fromItemStack(ItemResources.loadItem(name))
+ )
}
}
- })
+}
diff --git a/src/test/kotlin/util/skyblock/SackUtilTest.kt b/src/test/kotlin/util/skyblock/SackUtilTest.kt
index f93cd2b..e0e3e63 100644
--- a/src/test/kotlin/util/skyblock/SackUtilTest.kt
+++ b/src/test/kotlin/util/skyblock/SackUtilTest.kt
@@ -1,12 +1,12 @@
package moe.nea.firmament.test.util.skyblock
-import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.SackUtil
import moe.nea.firmament.util.skyblock.SkyBlockItems
-class SackUtilTest : AnnotationSpec() {
+class SackUtilTest {
@Test
fun testOneRottenFlesh() {
Assertions.assertEquals(