From 57baaeaff6193845f316128cdcfde55408f408c3 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 19 Apr 2024 08:54:23 +0200 Subject: [PATCH] Resolved some TODOs --- .../io/github/scalamath/TestScalaMath.java | 28 +++++++++---------- .../io/github/scalamath/ScalaMathSuite.scala | 8 +++--- .../scalamath/vecmatlib/Mat2x3dSuite.scala | 4 ++- .../scalamath/vecmatlib/Mat2x3fSuite.scala | 4 ++- .../scalamath/vecmatlib/Mat3x4dSuite.scala | 4 ++- .../scalamath/vecmatlib/Mat3x4fSuite.scala | 4 ++- .../scalamath/vecmatlib/QuatdSuite.scala | 8 ++++-- .../scalamath/vecmatlib/QuatfSuite.scala | 8 ++++-- 8 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/test/java/io/github/scalamath/TestScalaMath.java b/src/test/java/io/github/scalamath/TestScalaMath.java index 1184f66..393c4dd 100644 --- a/src/test/java/io/github/scalamath/TestScalaMath.java +++ b/src/test/java/io/github/scalamath/TestScalaMath.java @@ -63,10 +63,10 @@ public void testLongMoveToward() { @Test public void testFloatMoveToward() { - Assert.assertEquals(1.6f, ScalaMath.moveToward(1.0f, 2.0f, 0.6f), 1e-12); - Assert.assertEquals(2.0f, ScalaMath.moveToward(1.0f, 2.0f, 3.0f), 1e-12); - Assert.assertEquals(1.4f, ScalaMath.moveToward(2.0f, 1.0f, 0.6f), 1e-12); - Assert.assertEquals(1.0f, ScalaMath.moveToward(2.0f, 1.0f, 3.0f), 1e-12); + Assert.assertEquals(1.6f, ScalaMath.moveToward(1.0f, 2.0f, 0.6f), 1e-12f); + Assert.assertEquals(2.0f, ScalaMath.moveToward(1.0f, 2.0f, 3.0f), 1e-12f); + Assert.assertEquals(1.4f, ScalaMath.moveToward(2.0f, 1.0f, 0.6f), 1e-12f); + Assert.assertEquals(1.0f, ScalaMath.moveToward(2.0f, 1.0f, 3.0f), 1e-12f); } @Test @@ -93,9 +93,9 @@ public void testMapLongRange() { @Test public void testMapFloatRange() { - Assert.assertEquals(0.5f, ScalaMath.map(5.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12); - Assert.assertEquals(1.2f, ScalaMath.map(12.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12); - Assert.assertEquals(-0.1f, ScalaMath.map(-1.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12); + Assert.assertEquals(0.5f, ScalaMath.map(5.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12f); + Assert.assertEquals(1.2f, ScalaMath.map(12.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12f); + Assert.assertEquals(-0.1f, ScalaMath.map(-1.0f, 0.0f, 10.0f, 0.0f, 1.0f), 1e-12f); } @Test @@ -107,9 +107,9 @@ public void testMapDoubleRange() { @Test public void testSmoothstepFloat() { - Assert.assertEquals(0.5f, ScalaMath.smoothstep(3.0f, 4.0f, 3.5f), 1e-12); - Assert.assertEquals(0.0f, ScalaMath.smoothstep(3.0f, 4.0f, 2.0f), 1e-12); - Assert.assertEquals(1.0f, ScalaMath.smoothstep(3.0f, 4.0f, 5.0f), 1e-12); + Assert.assertEquals(0.5f, ScalaMath.smoothstep(3.0f, 4.0f, 3.5f), 1e-12f); + Assert.assertEquals(0.0f, ScalaMath.smoothstep(3.0f, 4.0f, 2.0f), 1e-12f); + Assert.assertEquals(1.0f, ScalaMath.smoothstep(3.0f, 4.0f, 5.0f), 1e-12f); } @Test @@ -140,13 +140,13 @@ public void testDoubleQuadraticBezierCurve() { @Test @Ignore public void testFloatQuadraticBezierDerivative() { - // TODO + // TODO: Quadratic Bézier derivative } @Test @Ignore public void testDoubleQuadraticBezierDerivative() { - // TODO + // TODO: Quadratic Bézier derivative } @Test @@ -176,13 +176,13 @@ public void testDoubleCubicBezierCurve() { @Test @Ignore public void testFloatCubicBezierDerivative() { - // TODO + // TODO: Cubic Bézier derivative } @Test @Ignore public void testDoubleCubicBezierDerivative() { - // TODO + // TODO: Cubic Bézier derivative } @Test diff --git a/src/test/scala/io/github/scalamath/ScalaMathSuite.scala b/src/test/scala/io/github/scalamath/ScalaMathSuite.scala index 48ceae8..1f5cd5e 100644 --- a/src/test/scala/io/github/scalamath/ScalaMathSuite.scala +++ b/src/test/scala/io/github/scalamath/ScalaMathSuite.scala @@ -119,11 +119,11 @@ class ScalaMathSuite extends AnyFunSuite { } ignore("Float quadratic Bézier derivative") { - // TODO + // TODO: Quadratic Bézier derivative } ignore("Double quadratic Bézier derivative") { - // TODO + // TODO: Quadratic Bézier derivative } test("Float cubic Bézier curve") { @@ -149,11 +149,11 @@ class ScalaMathSuite extends AnyFunSuite { } ignore("Float cubic Bézier derivative") { - // TODO + // TODO: Cubic Bézier derivative } ignore("Double cubic Bézier derivative") { - // TODO + // TODO: Cubic Bézier derivative } test("Float equals approx") { diff --git a/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3dSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3dSuite.scala index dc0418d..719d900 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3dSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3dSuite.scala @@ -159,7 +159,9 @@ class Mat2x3dSuite extends AnyFunSuite { assert(mat.floor == floor) } - // TODO: Orthonormalize + ignore("Orthonormalize matrix") { + // TODO: Orthonormalize matrix + } test("Matrix equals approx") { val m1 = Mat2x3d(1.00000001, 1.99999999, 3.00000001, 3.99999999, 0.00000001, -0.00000001) diff --git a/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3fSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3fSuite.scala index 50bf97d..dca3d47 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3fSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/Mat2x3fSuite.scala @@ -159,7 +159,9 @@ class Mat2x3fSuite extends AnyFunSuite { assert(mat.floor == floor) } - // TODO: Orthonormalize + ignore("Orthonormalize matrix") { + // TODO: Orthonormalize matrix + } test("Matrix equals approx") { val m1 = Mat2x3f(1.00000001f, 1.99999999f, 3.00000001f, 3.99999999f, 0.00000001f, -0.00000001f) diff --git a/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4dSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4dSuite.scala index 2e34209..f89fcfb 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4dSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4dSuite.scala @@ -174,7 +174,9 @@ class Mat3x4dSuite extends AnyFunSuite { assert(mat.floor == floor) } - // TODO: Orthonormalize + ignore("Orthonormalize matrix") { + // TODO: Orthonormalize matrix + } test("Matrix equals approx") { val m1 = Mat3x4d(1.00000001, 1.99999999, 3.00000001, 3.99999999, 5.00000001, 5.99999999, 7.00000001, 7.99999999, 9.00000001, 2.00000001, 1.99999999, 3.00000001) diff --git a/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4fSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4fSuite.scala index ea16e0b..bee0dad 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4fSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/Mat3x4fSuite.scala @@ -174,7 +174,9 @@ class Mat3x4fSuite extends AnyFunSuite { assert(mat.floor == floor) } - // TODO: Orthonormalize + ignore("Orthonormalize matrix") { + // TODO: Orthonormalize matrix + } test("Matrix equals approx") { val m1 = Mat3x4f(1.00000001f, 1.99999999f, 3.00000001f, 3.99999999f, 5.00000001f, 5.99999999f, 7.00000001f, 7.99999999f, 9.00000001f, 2.00000001f, 1.99999999f, 3.00000001f) diff --git a/src/test/scala/io/github/scalamath/vecmatlib/QuatdSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/QuatdSuite.scala index 41627f6..790d1ef 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/QuatdSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/QuatdSuite.scala @@ -212,7 +212,9 @@ class QuatdSuite extends AnyFunSuite { assert(q.inverse.pow(3) === q.pow(-3)) } - // TODO: angleTo + ignore("Angle between two quaternions") { + // TODO: Angle between two quaternions + } test("Quaternion slerp") { val sq2 = math.sqrt(2.0) / 2.0 @@ -272,5 +274,7 @@ class QuatdSuite extends AnyFunSuite { assert(q === res) } - // TODO: Quaternion from shortest arc + ignore("Quaternion from shortest arc") { + // TODO: Quaternion from shortest arc + } } diff --git a/src/test/scala/io/github/scalamath/vecmatlib/QuatfSuite.scala b/src/test/scala/io/github/scalamath/vecmatlib/QuatfSuite.scala index f738d29..8d5b931 100644 --- a/src/test/scala/io/github/scalamath/vecmatlib/QuatfSuite.scala +++ b/src/test/scala/io/github/scalamath/vecmatlib/QuatfSuite.scala @@ -212,7 +212,9 @@ class QuatfSuite extends AnyFunSuite { assert(q.inverse.pow(3) === q.pow(-3)) } - // TODO: angleTo + ignore("Angle between two quaternions") { + // TODO: Angle between two quaternions + } test("Quaternion slerp") { val sq2 = (math.sqrt(2.0) / 2.0).toFloat @@ -278,5 +280,7 @@ class QuatfSuite extends AnyFunSuite { assert(q === res) } - // TODO: Quaternion from shortest arc + ignore("Quaternion from shortest arc") { + // TODO: Quaternion from shortest arc + } }