Skip to content

Commit

Permalink
Resolved some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
HexagonNico committed Apr 19, 2024
1 parent 7751308 commit 57baaea
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 26 deletions.
28 changes: 14 additions & 14 deletions src/test/java/io/github/scalamath/TestScalaMath.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/test/scala/io/github/scalamath/ScalaMathSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions src/test/scala/io/github/scalamath/vecmatlib/QuatdSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
8 changes: 6 additions & 2 deletions src/test/scala/io/github/scalamath/vecmatlib/QuatfSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

0 comments on commit 57baaea

Please sign in to comment.