diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-06-17 20:59:45 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-06-17 21:19:43 +0200 |
| commit | 4b9e966ca7e8a9291f307850f715820e122d69fd (patch) | |
| tree | 94b08c865c882f93ff9c0c6aa7a507d47bcc67bf /src/test/kotlin/util/math/ProjectionsBoxTest.kt | |
| parent | 775933d516db10dbcc1cbbe405defa7b6e0c5a6a (diff) | |
| download | Firmament-4b9e966ca7e8a9291f307850f715820e122d69fd.tar.gz Firmament-4b9e966ca7e8a9291f307850f715820e122d69fd.tar.bz2 Firmament-4b9e966ca7e8a9291f307850f715820e122d69fd.zip | |
feat: Add macro wheels
Diffstat (limited to 'src/test/kotlin/util/math/ProjectionsBoxTest.kt')
| -rw-r--r-- | src/test/kotlin/util/math/ProjectionsBoxTest.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/kotlin/util/math/ProjectionsBoxTest.kt b/src/test/kotlin/util/math/ProjectionsBoxTest.kt new file mode 100644 index 0000000..04720a3 --- /dev/null +++ b/src/test/kotlin/util/math/ProjectionsBoxTest.kt @@ -0,0 +1,28 @@ +package moe.nea.firmament.test.util.math + +import java.util.stream.Stream +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.DynamicTest +import org.junit.jupiter.api.TestFactory +import kotlin.streams.asStream +import net.minecraft.util.math.Vec2f +import moe.nea.firmament.util.math.Projections + +class ProjectionsBoxTest { + val Double.degrees get() = Math.toRadians(this) + + @TestFactory + fun testProjections(): Stream<DynamicTest> { + return sequenceOf( + 0.0.degrees to Vec2f(1F, 0F), + 63.4349.degrees to Vec2f(0.5F, 1F), + ).map { (angle, expected) -> + DynamicTest.dynamicTest("ProjectionsBoxTest::projectAngleOntoUnitBox(${angle})") { + val actual = Projections.Two.projectAngleOntoUnitBox(angle) + fun msg() = "Expected (${expected.x}, ${expected.y}) got (${actual.x}, ${actual.y})" + Assertions.assertEquals(expected.x, actual.x, 0.0001F, ::msg) + Assertions.assertEquals(expected.y, actual.y, 0.0001F, ::msg) + } + }.asStream() + } +} |
