diff --git a/tests/OpenTK.Tests/Assertions.fs b/tests/OpenTK.Tests/Assertions.fs index b54ef7a2..0d0df594 100644 --- a/tests/OpenTK.Tests/Assertions.fs +++ b/tests/OpenTK.Tests/Assertions.fs @@ -12,11 +12,11 @@ module private AssertHelpers = let private BitAccuracy = 16 [] - let private EquivalenceTolerance = 0.0001f + let private EquivalenceTolerance = 0.00005f let approxEq a b = MathHelper.ApproximatelyEquivalent(a, b, EquivalenceTolerance) - //let approxEq a b = MathHelper.ApproximatelyEqual(a,b,BitAccuracy) - //let approxEq a b = MathHelper.ApproximatelyEqualEpsilon(a,b,0.0001f) + + let approxEqDelta a b = MathHelper.ApproximatelyEqual(a,b,BitAccuracy) let approxEqSingleEpsilon a b = MathHelper.ApproximatelyEqualEpsilon(a, b, 0.00001f) let approxEqDoubleEpsilon a b = MathHelper.ApproximatelyEqualEpsilon(a, b, 0.00001) @@ -32,17 +32,17 @@ module private AssertHelpers = [] type internal Assert = - static member ApproximatelyEqual(a : Vector2,b : Vector2) = + static member ApproximatelyEquivalent(a : Vector2,b : Vector2) = if not <| approxEq a.X b.X && approxEq a.Y b.Y then raise <| new Xunit.Sdk.EqualException(a,b) - static member ApproximatelyEqual(a : Vector3,b : Vector3) = + static member ApproximatelyEquivalent(a : Vector3,b : Vector3) = if not <| approxEq a.X b.X && approxEq a.Y b.Y && approxEq a.Z b.Z then raise <| new Xunit.Sdk.EqualException(a,b) - static member ApproximatelyEqual(a : Vector4,b : Vector4) = + static member ApproximatelyEquivalent(a : Vector4,b : Vector4) = if not <| approxEq a.X b.X && approxEq a.Y b.Y && approxEq a.Z b.Z && approxEq a.W b.W then raise <| new Xunit.Sdk.EqualException(a,b) - static member ApproximatelyEqual(a : float32,b : float32) = + static member ApproximatelyEquivalent(a : float32,b : float32) = if not <| approxEq a b then raise <| new Xunit.Sdk.EqualException(a,b) diff --git a/tests/OpenTK.Tests/MathHelperTests.fs b/tests/OpenTK.Tests/MathHelperTests.fs index fdd21f91..542f00cd 100644 --- a/tests/OpenTK.Tests/MathHelperTests.fs +++ b/tests/OpenTK.Tests/MathHelperTests.fs @@ -7,7 +7,7 @@ open System open OpenTK module MathHelper = - [ |], MaxTest = 10000)>] + [ |])>] module ``ApproximatelyEqual (delta)`` = /// This test ensures that approximately equal can never get it 'wrong' about the values. [] @@ -55,74 +55,74 @@ module MathHelper = Assert.Equal(a,b) Assert.True(MathHelper.ApproximatelyEqual(a,b,0)) - [ |], MaxTest = 10000)>] + [ |])>] module ``ApproximatelyEqual (single-precision epsilon)`` = // [] let ``ApproximatelyEqual (single precision) is correct for large positive values``() = - Assert.ApproximatelyEqualEpsilon(1000000.0f, 1000001.0f); - Assert.ApproximatelyEqualEpsilon(1000001.0f, 1000000.0f); + Assert.ApproximatelyEquivalentEpsilon(1000000.0f, 1000001.0f); + Assert.ApproximatelyEquivalentEpsilon(1000001.0f, 1000000.0f); Assert.NotApproximatelyEqualEpsilon(10000.0f, 10001.0f); Assert.NotApproximatelyEqualEpsilon(10001.0f, 10000.0f); [] let ``ApproximatelyEqual (single precision) is correct for large negative values``() = - Assert.ApproximatelyEqualEpsilon(-1000000.0f, -1000001.0f); - Assert.ApproximatelyEqualEpsilon(-1000001.0f, -1000000.0f); + Assert.ApproximatelyEquivalentEpsilon(-1000000.0f, -1000001.0f); + Assert.ApproximatelyEquivalentEpsilon(-1000001.0f, -1000000.0f); Assert.NotApproximatelyEqualEpsilon(-10000.0f, -10001.0f); Assert.NotApproximatelyEqualEpsilon(-10001.0f, -10000.0f); [] let ``ApproximatelyEqual (single precision) is correct for positive values around 1``() = - Assert.ApproximatelyEqualEpsilon(1.0000001f, 1.0000002f); - Assert.ApproximatelyEqualEpsilon(1.0000002f, 1.0000001f); + Assert.ApproximatelyEquivalentEpsilon(1.0000001f, 1.0000002f); + Assert.ApproximatelyEquivalentEpsilon(1.0000002f, 1.0000001f); Assert.NotApproximatelyEqualEpsilon(1.0002f, 1.0001f); Assert.NotApproximatelyEqualEpsilon(1.0001f, 1.0002f); [] let ``ApproximatelyEqual (single precision) is correct for negative values around -1``() = - Assert.ApproximatelyEqualEpsilon(-1.000001f, -1.000002f); - Assert.ApproximatelyEqualEpsilon(-1.000002f, -1.000001f); + Assert.ApproximatelyEquivalentEpsilon(-1.000001f, -1.000002f); + Assert.ApproximatelyEquivalentEpsilon(-1.000002f, -1.000001f); Assert.NotApproximatelyEqualEpsilon(-1.0001f, -1.0002f); Assert.NotApproximatelyEqualEpsilon(-1.0002f, -1.0001f); [] let ``ApproximatelyEqual (single precision) is correct for values between 1 and 0``() = - Assert.ApproximatelyEqualEpsilon(0.000000001000001f, 0.000000001000002f); - Assert.ApproximatelyEqualEpsilon(0.000000001000002f, 0.000000001000001f); + Assert.ApproximatelyEquivalentEpsilon(0.000000001000001f, 0.000000001000002f); + Assert.ApproximatelyEquivalentEpsilon(0.000000001000002f, 0.000000001000001f); Assert.NotApproximatelyEqualEpsilon(0.000000000001002f, 0.000000000001001f); Assert.NotApproximatelyEqualEpsilon(0.000000000001001f, 0.000000000001002f); [] let ``ApproximatelyEqual (single precision) is correct for values between -1 and 0``() = - Assert.ApproximatelyEqualEpsilon(-0.000000001000001f, -0.000000001000002f); - Assert.ApproximatelyEqualEpsilon(-0.000000001000002f, -0.000000001000001f); + Assert.ApproximatelyEquivalentEpsilon(-0.000000001000001f, -0.000000001000002f); + Assert.ApproximatelyEquivalentEpsilon(-0.000000001000002f, -0.000000001000001f); Assert.NotApproximatelyEqualEpsilon(-0.000000000001002f, -0.000000000001001f); Assert.NotApproximatelyEqualEpsilon(-0.000000000001001f, -0.000000000001002f); [] let ``ApproximatelyEqual (single precision) is correct for comparisons involving 0``() = - Assert.ApproximatelyEqualEpsilon(0.0f, 0.0f); - Assert.ApproximatelyEqualEpsilon(0.0f, -0.0f); - Assert.ApproximatelyEqualEpsilon(-0.0f, -0.0f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, 0.0f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, -0.0f); + Assert.ApproximatelyEquivalentEpsilon(-0.0f, -0.0f); Assert.NotApproximatelyEqualEpsilon(0.00000001f, 0.0f); Assert.NotApproximatelyEqualEpsilon(0.0f, 0.00000001f); Assert.NotApproximatelyEqualEpsilon(-0.00000001f, 0.0f); Assert.NotApproximatelyEqualEpsilon(0.0f, -0.00000001f); - Assert.ApproximatelyEqualEpsilon(0.0f, 1e-40f, 0.01f); - Assert.ApproximatelyEqualEpsilon(1e-40f, 0.0f, 0.01f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, 1e-40f, 0.01f); + Assert.ApproximatelyEquivalentEpsilon(1e-40f, 0.0f, 0.01f); Assert.NotApproximatelyEqualEpsilon(1e-40f, 0.0f, 0.000001f); Assert.NotApproximatelyEqualEpsilon(0.0f, 1e-40f, 0.000001f); - Assert.ApproximatelyEqualEpsilon(0.0f, -1e-40f, 0.1f); - Assert.ApproximatelyEqualEpsilon(-1e-40f, 0.0f, 0.1f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, -1e-40f, 0.1f); + Assert.ApproximatelyEquivalentEpsilon(-1e-40f, 0.0f, 0.1f); Assert.NotApproximatelyEqualEpsilon(-1e-40f, 0.0f, 0.00000001f); Assert.NotApproximatelyEqualEpsilon(0.0f, -1e-40f, 0.00000001f); [] let ``ApproximatelyEqual (single precision) is correct for extreme values with overflow potential``() = - Assert.ApproximatelyEqualEpsilon(System.Single.MaxValue, System.Single.MaxValue); + Assert.ApproximatelyEquivalentEpsilon(System.Single.MaxValue, System.Single.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Single.MaxValue, -System.Single.MaxValue); Assert.NotApproximatelyEqualEpsilon(-System.Single.MaxValue, System.Single.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Single.MaxValue, System.Single.MaxValue / 2.0f); @@ -131,8 +131,8 @@ module MathHelper = [] let ``ApproximatelyEqual (single precision) is correct for values involving infinities``() = - Assert.ApproximatelyEqualEpsilon(System.Single.PositiveInfinity, System.Single.PositiveInfinity); - Assert.ApproximatelyEqualEpsilon(System.Single.NegativeInfinity, System.Single.NegativeInfinity); + Assert.ApproximatelyEquivalentEpsilon(System.Single.PositiveInfinity, System.Single.PositiveInfinity); + Assert.ApproximatelyEquivalentEpsilon(System.Single.NegativeInfinity, System.Single.NegativeInfinity); Assert.NotApproximatelyEqualEpsilon(System.Single.NegativeInfinity, System.Single.PositiveInfinity); Assert.NotApproximatelyEqualEpsilon(System.Single.PositiveInfinity, System.Single.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Single.NegativeInfinity, -System.Single.MaxValue); @@ -163,92 +163,92 @@ module MathHelper = Assert.NotApproximatelyEqualEpsilon(-1.0f, 1.000000001f); Assert.NotApproximatelyEqualEpsilon(-1.000000001f, 1.0f); Assert.NotApproximatelyEqualEpsilon(1.0f, -1.000000001f); - Assert.ApproximatelyEqualEpsilon(10.0f * System.Single.Epsilon, 10.0f * -System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(10.0f * System.Single.Epsilon, 10.0f * -System.Single.Epsilon); Assert.NotApproximatelyEqualEpsilon(10000.0f * System.Single.Epsilon, 10000.0f * -System.Single.Epsilon); [] let ``ApproximatelyEqual (single precision) is correct for values very close to 0``() = - Assert.ApproximatelyEqualEpsilon(System.Single.Epsilon, System.Single.Epsilon); - Assert.ApproximatelyEqualEpsilon(System.Single.Epsilon, -System.Single.Epsilon); - Assert.ApproximatelyEqualEpsilon(-System.Single.Epsilon, System.Single.Epsilon); - Assert.ApproximatelyEqualEpsilon(System.Single.Epsilon, 0.0f); - Assert.ApproximatelyEqualEpsilon(0.0f, System.Single.Epsilon); - Assert.ApproximatelyEqualEpsilon(-System.Single.Epsilon, 0.0f); - Assert.ApproximatelyEqualEpsilon(0.0f, -System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Single.Epsilon, System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Single.Epsilon, -System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(-System.Single.Epsilon, System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Single.Epsilon, 0.0f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, System.Single.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(-System.Single.Epsilon, 0.0f); + Assert.ApproximatelyEquivalentEpsilon(0.0f, -System.Single.Epsilon); Assert.NotApproximatelyEqualEpsilon(0.000000001f, -System.Single.Epsilon); Assert.NotApproximatelyEqualEpsilon(0.000000001f, System.Single.Epsilon); Assert.NotApproximatelyEqualEpsilon(System.Single.Epsilon, 0.000000001f); Assert.NotApproximatelyEqualEpsilon(-System.Single.Epsilon, 0.000000001f); - [ |], MaxTest = 10000)>] + [ |])>] module ``ApproximatelyEqual (double-precision epsilon)`` = // [] let ``ApproximatelyEqual (double precision) is correct for large positive values``() = - Assert.ApproximatelyEqualEpsilon(1000000.0, 1000001.0); - Assert.ApproximatelyEqualEpsilon(1000001.0, 1000000.0); + Assert.ApproximatelyEquivalentEpsilon(1000000.0, 1000001.0); + Assert.ApproximatelyEquivalentEpsilon(1000001.0, 1000000.0); Assert.NotApproximatelyEqualEpsilon(10000.0, 10001.0); Assert.NotApproximatelyEqualEpsilon(10001.0, 10000.0); [] let ``ApproximatelyEqual (double precision) is correct for large negative values``() = - Assert.ApproximatelyEqualEpsilon(-1000000.0, -1000001.0); - Assert.ApproximatelyEqualEpsilon(-1000001.0, -1000000.0); + Assert.ApproximatelyEquivalentEpsilon(-1000000.0, -1000001.0); + Assert.ApproximatelyEquivalentEpsilon(-1000001.0, -1000000.0); Assert.NotApproximatelyEqualEpsilon(-10000.0, -10001.0); Assert.NotApproximatelyEqualEpsilon(-10001.0, -10000.0); [] let ``ApproximatelyEqual (double precision) is correct for positive values around 1``() = - Assert.ApproximatelyEqualEpsilon(1.0000001, 1.0000002); - Assert.ApproximatelyEqualEpsilon(1.0000002, 1.0000001); + Assert.ApproximatelyEquivalentEpsilon(1.0000001, 1.0000002); + Assert.ApproximatelyEquivalentEpsilon(1.0000002, 1.0000001); Assert.NotApproximatelyEqualEpsilon(1.0002, 1.0001); Assert.NotApproximatelyEqualEpsilon(1.0001, 1.0002); [] let ``ApproximatelyEqual (double precision) is correct for negative values around -1``() = - Assert.ApproximatelyEqualEpsilon(-1.000001, -1.000002); - Assert.ApproximatelyEqualEpsilon(-1.000002, -1.000001); + Assert.ApproximatelyEquivalentEpsilon(-1.000001, -1.000002); + Assert.ApproximatelyEquivalentEpsilon(-1.000002, -1.000001); Assert.NotApproximatelyEqualEpsilon(-1.0001, -1.0002); Assert.NotApproximatelyEqualEpsilon(-1.0002, -1.0001); [] let ``ApproximatelyEqual (double precision) is correct for values between 1 and 0``() = - Assert.ApproximatelyEqualEpsilon(0.000000001000001, 0.000000001000002); - Assert.ApproximatelyEqualEpsilon(0.000000001000002, 0.000000001000001); + Assert.ApproximatelyEquivalentEpsilon(0.000000001000001, 0.000000001000002); + Assert.ApproximatelyEquivalentEpsilon(0.000000001000002, 0.000000001000001); Assert.NotApproximatelyEqualEpsilon(0.000000000001002, 0.000000000001001); Assert.NotApproximatelyEqualEpsilon(0.000000000001001, 0.000000000001002); [] let ``ApproximatelyEqual (double precision) is correct for values between -1 and 0``() = - Assert.ApproximatelyEqualEpsilon(-0.000000001000001, -0.000000001000002); - Assert.ApproximatelyEqualEpsilon(-0.000000001000002, -0.000000001000001); + Assert.ApproximatelyEquivalentEpsilon(-0.000000001000001, -0.000000001000002); + Assert.ApproximatelyEquivalentEpsilon(-0.000000001000002, -0.000000001000001); Assert.NotApproximatelyEqualEpsilon(-0.000000000001002, -0.000000000001001); Assert.NotApproximatelyEqualEpsilon(-0.000000000001001, -0.000000000001002); [] let ``ApproximatelyEqual (double precision) is correct for comparisons involving 0``() = - Assert.ApproximatelyEqualEpsilon(0.0, 0.0); - Assert.ApproximatelyEqualEpsilon(0.0, -0.0); - Assert.ApproximatelyEqualEpsilon(-0.0, -0.0); + Assert.ApproximatelyEquivalentEpsilon(0.0, 0.0); + Assert.ApproximatelyEquivalentEpsilon(0.0, -0.0); + Assert.ApproximatelyEquivalentEpsilon(-0.0, -0.0); Assert.NotApproximatelyEqualEpsilon(0.00000001, 0.0); Assert.NotApproximatelyEqualEpsilon(0.0, 0.00000001); Assert.NotApproximatelyEqualEpsilon(-0.00000001, 0.0); Assert.NotApproximatelyEqualEpsilon(0.0, -0.00000001); - Assert.ApproximatelyEqualEpsilon(0.0, 1e-310, 0.01); - Assert.ApproximatelyEqualEpsilon(1e-310, 0.0, 0.01); + Assert.ApproximatelyEquivalentEpsilon(0.0, 1e-310, 0.01); + Assert.ApproximatelyEquivalentEpsilon(1e-310, 0.0, 0.01); Assert.NotApproximatelyEqualEpsilon(1e-310, 0.0, 0.000001); Assert.NotApproximatelyEqualEpsilon(0.0, 1e-310, 0.000001); - Assert.ApproximatelyEqualEpsilon(0.0, -1e-310, 0.1); - Assert.ApproximatelyEqualEpsilon(-1e-310, 0.0, 0.1); + Assert.ApproximatelyEquivalentEpsilon(0.0, -1e-310, 0.1); + Assert.ApproximatelyEquivalentEpsilon(-1e-310, 0.0, 0.1); Assert.NotApproximatelyEqualEpsilon(-1e-310, 0.0, 0.00000001); Assert.NotApproximatelyEqualEpsilon(0.0, -1e-310, 0.00000001); [] let ``ApproximatelyEqual (double precision) is correct for extreme values with overflow potential``() = - Assert.ApproximatelyEqualEpsilon(System.Double.MaxValue, System.Double.MaxValue); + Assert.ApproximatelyEquivalentEpsilon(System.Double.MaxValue, System.Double.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Double.MaxValue, -System.Double.MaxValue); Assert.NotApproximatelyEqualEpsilon(-System.Double.MaxValue, System.Double.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Double.MaxValue, System.Double.MaxValue / 2.0); @@ -257,8 +257,8 @@ module MathHelper = [] let ``ApproximatelyEqual (double precision) is correct for values involving infinities``() = - Assert.ApproximatelyEqualEpsilon(System.Double.PositiveInfinity, System.Double.PositiveInfinity); - Assert.ApproximatelyEqualEpsilon(System.Double.NegativeInfinity, System.Double.NegativeInfinity); + Assert.ApproximatelyEquivalentEpsilon(System.Double.PositiveInfinity, System.Double.PositiveInfinity); + Assert.ApproximatelyEquivalentEpsilon(System.Double.NegativeInfinity, System.Double.NegativeInfinity); Assert.NotApproximatelyEqualEpsilon(System.Double.NegativeInfinity, System.Double.PositiveInfinity); Assert.NotApproximatelyEqualEpsilon(System.Double.PositiveInfinity, System.Double.MaxValue); Assert.NotApproximatelyEqualEpsilon(System.Double.NegativeInfinity, -System.Double.MaxValue); @@ -289,25 +289,25 @@ module MathHelper = Assert.NotApproximatelyEqualEpsilon(-1.0, 1.000000001); Assert.NotApproximatelyEqualEpsilon(-1.000000001, 1.0); Assert.NotApproximatelyEqualEpsilon(1.0, -1.000000001); - Assert.ApproximatelyEqualEpsilon(10.0 * System.Double.Epsilon, 10.0 * -System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(10.0 * System.Double.Epsilon, 10.0 * -System.Double.Epsilon); Assert.NotApproximatelyEqualEpsilon(100000000000.0 * System.Double.Epsilon, 100000000000.0 * -System.Double.Epsilon); [] let ``ApproximatelyEqual (double precision) is correct for values very close to 0``() = - Assert.ApproximatelyEqualEpsilon(System.Double.Epsilon, System.Double.Epsilon); - Assert.ApproximatelyEqualEpsilon(System.Double.Epsilon, -System.Double.Epsilon); - Assert.ApproximatelyEqualEpsilon(-System.Double.Epsilon, System.Double.Epsilon); - Assert.ApproximatelyEqualEpsilon(System.Double.Epsilon, 0.0); - Assert.ApproximatelyEqualEpsilon(0.0, System.Double.Epsilon); - Assert.ApproximatelyEqualEpsilon(-System.Double.Epsilon, 0.0); - Assert.ApproximatelyEqualEpsilon(0.0, -System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Double.Epsilon, System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Double.Epsilon, -System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(-System.Double.Epsilon, System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(System.Double.Epsilon, 0.0); + Assert.ApproximatelyEquivalentEpsilon(0.0, System.Double.Epsilon); + Assert.ApproximatelyEquivalentEpsilon(-System.Double.Epsilon, 0.0); + Assert.ApproximatelyEquivalentEpsilon(0.0, -System.Double.Epsilon); Assert.NotApproximatelyEqualEpsilon(0.000000001, -System.Double.Epsilon); Assert.NotApproximatelyEqualEpsilon(0.000000001, System.Double.Epsilon); Assert.NotApproximatelyEqualEpsilon(System.Double.Epsilon, 0.000000001); Assert.NotApproximatelyEqualEpsilon(-System.Double.Epsilon, 0.000000001); - [ |], MaxTest = 10000)>] + [ |])>] module ``ApproximatelyEquivalent (tolerance diff)`` = [] let ``ApproximatelyEquivalent correctly approximates equivalence where the difference falls below the tolerance``() = @@ -317,11 +317,11 @@ module MathHelper = Assert.True(MathHelper.ApproximatelyEquivalent(a, b, 0.0001f)) [] - let ``ApproximatelyEquivalent correctly approximates inequivalence where the difference is the tolerance``() = + let ``ApproximatelyEquivalent correctly approximates equivalence where the difference is the tolerance``() = let a = 0.0001f let b = 0.0002f Assert.NotEqual(a,b) - Assert.False(MathHelper.ApproximatelyEquivalent(a, b, 0.0001f)) + Assert.True(MathHelper.ApproximatelyEquivalent(a, b, 0.0001f)) [] let ``ApproximatelyEquivalent correctly approximates inequivalence where the difference exceeds the tolerance``() = @@ -332,7 +332,7 @@ module MathHelper = [] let ``ApproximatelyEquivalent reports very different values as non-equal even with a high tolerance``() = - let a = 2.0f + let a = 3.0f let b = 1.0f Assert.NotEqual(a,b) Assert.False(MathHelper.ApproximatelyEquivalent(a, b, 1.0f)) diff --git a/tests/OpenTK.Tests/Matrix4Tests.fs b/tests/OpenTK.Tests/Matrix4Tests.fs index 43dc471c..e4ca3f5d 100644 --- a/tests/OpenTK.Tests/Matrix4Tests.fs +++ b/tests/OpenTK.Tests/Matrix4Tests.fs @@ -7,7 +7,7 @@ open System open OpenTK module Matrix4 = - [ |], MaxTest = 10000)>] + [ |])>] module Constructors = // [] @@ -88,7 +88,7 @@ module Matrix4 = Assert.Equal(o, A.M43) Assert.Equal(p, A.M44) - [ |], MaxTest = 10000)>] + [ |])>] module Equality = // [] @@ -103,7 +103,7 @@ module Matrix4 = let ``A matrix is not equal to an object which is not a matrix`` (a : Matrix4, b : Vector3) = Assert.False(a.Equals(b)) - [ |], MaxTest = 10000)>] + [ |])>] module Multiplication = // [] @@ -202,7 +202,7 @@ module Matrix4 = Assert.Equal(R4, AScaled.Row3) - [ |], MaxTest = 10000)>] + [ |])>] module Addition = // [] @@ -232,7 +232,7 @@ module Matrix4 = Assert.Equal(o + o, sum.M43) Assert.Equal(p + p, sum.M44) - [ |], MaxTest = 10000)>] + [ |])>] module Subtraction = // [] @@ -262,7 +262,7 @@ module Matrix4 = Assert.Equal(o - o, sub.M43) Assert.Equal(p - p, sub.M44) - [ |], MaxTest = 10000)>] + [ |])>] module Indexing = // [] @@ -363,7 +363,7 @@ module Matrix4 = (fun() -> a.[1, 6] |> ignore) |> Assert.ThrowsIndexExn (fun() -> a.[7, 12] |> ignore) |> Assert.ThrowsIndexExn - [ |], MaxTest = 10000)>] + [ |])>] module ``Row and column properties`` = // [] diff --git a/tests/OpenTK.Tests/Vector2Tests.fs b/tests/OpenTK.Tests/Vector2Tests.fs index ae595064..e44d8de6 100644 --- a/tests/OpenTK.Tests/Vector2Tests.fs +++ b/tests/OpenTK.Tests/Vector2Tests.fs @@ -8,7 +8,7 @@ open System.Runtime.InteropServices open OpenTK module Vector2 = - [ |], MaxTest = 10000)>] + [ |])>] module Constructors = // [] @@ -23,7 +23,7 @@ module Vector2 = Assert.Equal(x,v.X) Assert.Equal(y,v.Y) - [ |], MaxTest = 10000)>] + [ |])>] module Clamping = // [] @@ -46,7 +46,7 @@ module Vector2 = Assert.Equal(expX, res.X) Assert.Equal(expY, res.Y) - [ |], MaxTest = 10000)>] + [ |])>] module Length = // [] @@ -75,7 +75,7 @@ module Vector2 = Assert.Equal(lsq, v.LengthSquared) - [ |], MaxTest = 10000)>] + [ |])>] module ``Unit vectors and perpendicularity`` = // [] @@ -92,7 +92,7 @@ module Vector2 = Assert.Equal(perp, v.PerpendicularLeft) - [ |], MaxTest = 10000)>] + [ |])>] module Indexing = // [] @@ -126,7 +126,7 @@ module Vector2 = (fun() -> v.[2] |> ignore) |> Assert.ThrowsIndexExn - [ |], MaxTest = 10000)>] + [ |])>] module ``Simple Properties`` = // [] @@ -139,26 +139,26 @@ module Vector2 = // Assert.True(a.Length >= 0.0f) - [ |], MaxTest = 10000)>] + [ |])>] module Addition = // [] let ``Vector addition is the same as component addition`` (a : Vector2,b : Vector2) = let c = a + b - Assert.ApproximatelyEqual(a.X + b.X,c.X) - Assert.ApproximatelyEqual(a.Y + b.Y,c.Y) + Assert.ApproximatelyEquivalent(a.X + b.X,c.X) + Assert.ApproximatelyEquivalent(a.Y + b.Y,c.Y) [] let ``Vector addition is commutative`` (a : Vector2,b : Vector2) = let c = a + b let c2 = b + a - Assert.ApproximatelyEqual(c,c2) + Assert.ApproximatelyEquivalent(c,c2) [] let ``Vector addition is associative`` (a : Vector2,b : Vector2,c : Vector2) = let r1 = (a + b) + c let r2 = a + (b + c) - Assert.ApproximatelyEqual(r1,r2) + Assert.ApproximatelyEquivalent(r1,r2) [] let ``Static Vector2 addition method is the same as component addition`` (a : Vector2, b : Vector2) = @@ -166,7 +166,7 @@ module Vector2 = let v1 = Vector2(a.X + b.X, a.Y + b.Y) let sum = Vector2.Add(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2 addition method by reference is the same as component addition`` (a : Vector2, b : Vector2) = @@ -174,9 +174,9 @@ module Vector2 = let v1 = Vector2(a.X + b.X, a.Y + b.Y) let sum = Vector2.Add(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Multiplication = // [] @@ -210,7 +210,7 @@ module Vector2 = let v1 = Vector2(a.X * b.X, a.Y * b.Y) let sum = Vector2.Multiply(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2 multiplication method by reference is the same as component multiplication`` (a : Vector2, b : Vector2) = @@ -218,7 +218,7 @@ module Vector2 = let v1 = Vector2(a.X * b.X, a.Y * b.Y) let sum = Vector2.Multiply(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static method Vector2-scalar multiplication is the same as component-scalar multiplication`` (a : Vector2, f : float32) = @@ -227,7 +227,7 @@ module Vector2 = Assert.Equal(a.X * f,r.X) Assert.Equal(a.Y * f,r.Y) - [ |], MaxTest = 10000)>] + [ |])>] module Subtraction = // [] @@ -242,7 +242,7 @@ module Vector2 = let v1 = Vector2(a.X - b.X, a.Y - b.Y) let sum = Vector2.Subtract(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2 subtraction method by reference is the same as component addition`` (a : Vector2, b : Vector2) = @@ -250,9 +250,9 @@ module Vector2 = let v1 = Vector2(a.X - b.X, a.Y - b.Y) let sum = Vector2.Subtract(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Division = // [] @@ -260,8 +260,8 @@ module Vector2 = if not (approxEq f 0.0f) then let r = a / f - Assert.ApproximatelyEqual(a.X / f,r.X) - Assert.ApproximatelyEqual(a.Y / f,r.Y) + Assert.ApproximatelyEquivalent(a.X / f,r.X) + Assert.ApproximatelyEquivalent(a.Y / f,r.Y) [] let ``Static Vector2-Vector2 division method is the same as component division`` (a : Vector2, b : Vector2) = @@ -269,7 +269,7 @@ module Vector2 = let v1 = Vector2(a.X / b.X, a.Y / b.Y) let sum = Vector2.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2-Vector2 divison method by reference `` (a : Vector2, b : Vector2) = @@ -277,7 +277,7 @@ module Vector2 = let v1 = Vector2(a.X / b.X, a.Y / b.Y) let sum = Vector2.Divide(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2-scalar division method is the same as component division`` (a : Vector2, b : float32) = @@ -285,7 +285,7 @@ module Vector2 = let v1 = Vector2(a.X / b, a.Y / b) let sum = Vector2.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector2-scalar divison method by reference is the same as component division`` (a : Vector2, b : float32) = @@ -293,9 +293,9 @@ module Vector2 = let v1 = Vector2(a.X / b, a.Y / b) let sum = Vector2.Divide(ref a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Negation = // [] @@ -305,7 +305,7 @@ module Vector2 = Assert.Equal(-x, vNeg.X) Assert.Equal(-y, vNeg.Y) - [ |], MaxTest = 10000)>] + [ |])>] module Equality = // [] @@ -336,7 +336,7 @@ module Vector2 = Assert.True(equality) Assert.False(inequalityByOtherType) - [ |], MaxTest = 10000)>] + [ |])>] module Swizzling = // [] @@ -347,7 +347,7 @@ module Vector2 = let v1yx = v1.Yx; Assert.Equal(v2, v1yx); - [ |], MaxTest = 10000)>] + [ |])>] module Interpolation = // [] @@ -374,7 +374,7 @@ module Vector2 = let vRes = Vector2.BaryCentric(ref a, ref b, ref c, u, v) Assert.Equal(r, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module ``Vector products`` = // [] @@ -395,7 +395,7 @@ module Vector2 = let vRes = Vector2.PerpDot(ref a, ref b) Assert.Equal(perpDot, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module Normalization = // [] @@ -407,8 +407,8 @@ module Vector2 = if not (approxEq l 0.0f) then let norm = v.Normalized() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) [] let ``Normalization of instance transforms the instance into a unit length vector with the correct components`` (a, b) = @@ -419,8 +419,8 @@ module Vector2 = let norm = Vector2(a, b) norm.Normalize() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) [] let ``Fast approximate normalization of instance transforms the instance into a unit length vector with the correct components`` (a, b) = @@ -430,8 +430,8 @@ module Vector2 = let scale = MathHelper.InverseSqrtFast(a * a + b * b) - Assert.ApproximatelyEqual(v.X * scale, norm.X) - Assert.ApproximatelyEqual(v.Y * scale, norm.Y) + Assert.ApproximatelyEquivalent(v.X * scale, norm.X) + Assert.ApproximatelyEquivalent(v.Y * scale, norm.Y) [] let ``Normalization by reference is the same as division by magnitude`` (a : Vector2) = @@ -440,7 +440,7 @@ module Vector2 = let norm = a / a.Length let vRes = Vector2.Normalize(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Normalization is the same as division by magnitude`` (a : Vector2) = @@ -448,7 +448,7 @@ module Vector2 = if not (approxEq a.Length 0.0f) then let norm = a / a.Length - Assert.ApproximatelyEqual(norm, Vector2.Normalize(a)); + Assert.ApproximatelyEquivalent(norm, Vector2.Normalize(a)); [] let ``Fast approximate normalization by reference is the same as multiplication by the fast inverse square`` (a : Vector2) = @@ -457,7 +457,7 @@ module Vector2 = let norm = a * scale let vRes = Vector2.NormalizeFast(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Fast approximate normalization is the same as multiplication by the fast inverse square`` (a : Vector2) = @@ -465,9 +465,9 @@ module Vector2 = let norm = a * scale - Assert.ApproximatelyEqual(norm, Vector2.NormalizeFast(a)); + Assert.ApproximatelyEquivalent(norm, Vector2.NormalizeFast(a)); - [ |], MaxTest = 10000)>] + [ |])>] module ``Magnitude min and max`` = // [] @@ -534,7 +534,7 @@ module Vector2 = let v2LongerThanv1 = l2 > l1 Assert.True(v2LongerThanv1) - [ |], MaxTest = 10000)>] + [ |])>] module ``Component min and max`` = // [] @@ -569,7 +569,7 @@ module Vector2 = Assert.True(isComponentLargest vMax.X v1.X v2.X) Assert.True(isComponentLargest vMax.Y v1.Y v2.Y) - [ |], MaxTest = 10000)>] + [ |])>] module Transformation = // [] @@ -580,7 +580,7 @@ module Vector2 = let transformedQuat = q * vectorQuat * inverse let transformedVector = Vector2(transformedQuat.X, transformedQuat.Y) - Assert.ApproximatelyEqual(transformedVector, Vector2.Transform(v, q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector2.Transform(v, q)) [] let ``Transformation by quaternion by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector2, q : Quaternion) = @@ -590,9 +590,9 @@ module Vector2 = let transformedQuat = q * vectorQuat * inverse let transformedVector = Vector2(transformedQuat.X, transformedQuat.Y) - Assert.ApproximatelyEqual(transformedVector, Vector2.Transform(ref v, ref q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector2.Transform(ref v, ref q)) - [ |], MaxTest = 10000)>] + [ |])>] module Serialization = // [] diff --git a/tests/OpenTK.Tests/Vector3Tests.fs b/tests/OpenTK.Tests/Vector3Tests.fs index 6428684e..c12c0f18 100644 --- a/tests/OpenTK.Tests/Vector3Tests.fs +++ b/tests/OpenTK.Tests/Vector3Tests.fs @@ -8,7 +8,7 @@ open System.Runtime.InteropServices open OpenTK module Vector3 = - [ |], MaxTest = 10000)>] + [ |])>] module Constructors = // [] @@ -65,7 +65,7 @@ module Vector3 = Assert.Equal(b, v2.Y) Assert.Equal(c, v2.Z) - [ |], MaxTest = 10000)>] + [ |])>] module Indexing = // [] @@ -100,7 +100,7 @@ module Vector3 = (fun() -> v.[4] |> ignore) |> Assert.ThrowsIndexExn - [ |], MaxTest = 10000)>] + [ |])>] module Length = // [] @@ -124,7 +124,7 @@ module Vector3 = Assert.Equal(lsq, v.LengthSquared) - [ |], MaxTest = 10000)>] + [ |])>] module Normalization = // [] @@ -136,9 +136,9 @@ module Vector3 = if not (approxEq l 0.0f) then let norm = v.Normalized() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) - Assert.ApproximatelyEqual(v.Z / l, norm.Z) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.Z / l, norm.Z) [] let ``Normalization of instance transforms the instance into a unit length vector with the correct components`` (a, b, c) = @@ -149,9 +149,9 @@ module Vector3 = let norm = Vector3(a, b, c) norm.Normalize() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) - Assert.ApproximatelyEqual(v.Z / l, norm.Z) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.Z / l, norm.Z) [] let ``Fast approximate normalization of instance transforms the instance into a unit length vector with the correct components`` (a, b, c) = @@ -161,9 +161,9 @@ module Vector3 = let scale = MathHelper.InverseSqrtFast(a * a + b * b + c * c) - Assert.ApproximatelyEqual(v.X * scale, norm.X) - Assert.ApproximatelyEqual(v.Y * scale, norm.Y) - Assert.ApproximatelyEqual(v.Z * scale, norm.Z) + Assert.ApproximatelyEquivalent(v.X * scale, norm.X) + Assert.ApproximatelyEquivalent(v.Y * scale, norm.Y) + Assert.ApproximatelyEquivalent(v.Z * scale, norm.Z) [] let ``Normalization by reference is the same as division by magnitude`` (a : Vector3) = @@ -172,7 +172,7 @@ module Vector3 = let norm = a / a.Length let vRes = Vector3.Normalize(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Normalization is the same as division by magnitude`` (a : Vector3) = @@ -180,7 +180,7 @@ module Vector3 = if not (approxEq a.Length 0.0f) then let norm = a / a.Length - Assert.ApproximatelyEqual(norm, Vector3.Normalize(a)); + Assert.ApproximatelyEquivalent(norm, Vector3.Normalize(a)); [] let ``Fast approximate normalization by reference is the same as multiplication by the fast inverse square`` (a : Vector3) = @@ -189,7 +189,7 @@ module Vector3 = let norm = a * scale let vRes = Vector3.NormalizeFast(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Fast approximate normalization is the same as multiplication by fast inverse square`` (a : Vector3) = @@ -197,32 +197,32 @@ module Vector3 = let norm = a * scale - Assert.ApproximatelyEqual(norm, Vector3.NormalizeFast(a)); + Assert.ApproximatelyEquivalent(norm, Vector3.NormalizeFast(a)); - [ |], MaxTest = 10000)>] + [ |])>] module Addition = // [] let ``Vector3 addition is the same as component addition`` (a : Vector3, b : Vector3) = let c = a + b - Assert.ApproximatelyEqual(a.X + b.X,c.X) - Assert.ApproximatelyEqual(a.Y + b.Y,c.Y) - Assert.ApproximatelyEqual(a.Z + b.Z,c.Z) + Assert.ApproximatelyEquivalent(a.X + b.X,c.X) + Assert.ApproximatelyEquivalent(a.Y + b.Y,c.Y) + Assert.ApproximatelyEquivalent(a.Z + b.Z,c.Z) [] let ``Vector3 addition is commutative`` (a : Vector3, b : Vector3) = let c = a + b let c2 = b + a - Assert.ApproximatelyEqual(c, c2) + Assert.ApproximatelyEquivalent(c, c2) [] let ``Vector3 addition is associative`` (a : Vector3, b : Vector3, c : Vector3) = let r1 = (a + b) + c let r2 = a + (b + c) - Assert.ApproximatelyEqual(r1, r2) + Assert.ApproximatelyEquivalent(r1, r2) [] let ``Static Vector3 addition method is the same as component addition`` (a : Vector3, b : Vector3) = @@ -230,7 +230,7 @@ module Vector3 = let v1 = Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z) let sum = Vector3.Add(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3 addition method by reference is the same as component addition`` (a : Vector3, b : Vector3) = @@ -238,9 +238,9 @@ module Vector3 = let v1 = Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z) let sum = Vector3.Add(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Subtraction = // [] @@ -257,7 +257,7 @@ module Vector3 = let v1 = Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z) let sum = Vector3.Subtract(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3 subtraction method by reference is the same as component addition`` (a : Vector3, b : Vector3) = @@ -265,9 +265,9 @@ module Vector3 = let v1 = Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z) let sum = Vector3.Subtract(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Multiplication = // [] @@ -338,7 +338,7 @@ module Vector3 = let v1 = Vector3(a.X * b.X, a.Y * b.Y, a.Z * b.Z) let sum = Vector3.Multiply(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3 multiplication method by reference is the same as component multiplication`` (a : Vector3, b : Vector3) = @@ -346,9 +346,9 @@ module Vector3 = let v1 = Vector3(a.X * b.X, a.Y * b.Y, a.Z * b.Z) let sum = Vector3.Multiply(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Division = // [] @@ -356,9 +356,9 @@ module Vector3 = if not (approxEq f 0.0f) then // we don't support diving by zero. let r = a / f - Assert.ApproximatelyEqual(a.X / f,r.X) - Assert.ApproximatelyEqual(a.Y / f,r.Y) - Assert.ApproximatelyEqual(a.Z / f,r.Z) + Assert.ApproximatelyEquivalent(a.X / f,r.X) + Assert.ApproximatelyEquivalent(a.Y / f,r.Y) + Assert.ApproximatelyEquivalent(a.Z / f,r.Z) [] let ``Static Vector3-Vector3 division method is the same as component division`` (a : Vector3, b : Vector3) = @@ -366,7 +366,7 @@ module Vector3 = let v1 = Vector3(a.X / b.X, a.Y / b.Y, a.Z / b.Z) let sum = Vector3.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3-Vector3 divison method by reference is the same as component division`` (a : Vector3, b : Vector3) = @@ -374,7 +374,7 @@ module Vector3 = let v1 = Vector3(a.X / b.X, a.Y / b.Y, a.Z / b.Z) let sum = Vector3.Divide(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3-scalar division method is the same as component division`` (a : Vector3, b : float32) = @@ -382,7 +382,7 @@ module Vector3 = let v1 = Vector3(a.X / b, a.Y / b, a.Z / b) let sum = Vector3.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector3-scalar divison method by reference is the same as component division`` (a : Vector3, b : float32) = @@ -390,9 +390,9 @@ module Vector3 = let v1 = Vector3(a.X / b, a.Y / b, a.Z / b) let sum = Vector3.Divide(ref a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Negation = // [] @@ -403,7 +403,7 @@ module Vector3 = Assert.Equal(-y, vNeg.Y) Assert.Equal(-z, vNeg.Z) - [ |], MaxTest = 10000)>] + [ |])>] module Equality = // [] @@ -434,7 +434,7 @@ module Vector3 = Assert.True(equality) Assert.False(inequalityByOtherType) - [ |], MaxTest = 10000)>] + [ |])>] module Swizzling = // [] @@ -479,7 +479,7 @@ module Vector3 = Assert.Equal(zx, v.Zx); Assert.Equal(zy, v.Zy); - [ |], MaxTest = 10000)>] + [ |])>] module Interpolation = // [] @@ -507,7 +507,7 @@ module Vector3 = let vRes = Vector3.BaryCentric(ref a, ref b, ref c, u, v) Assert.Equal(r, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module ``Vector products`` = // [] @@ -531,7 +531,7 @@ module Vector3 = let vRes = Vector3.Cross(ref a, ref b) Assert.Equal(cross, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module ``Magnitude min and max`` = // [] @@ -598,7 +598,7 @@ module Vector3 = let v2LongerThanv1 = l2 > l1 Assert.True(v2LongerThanv1) - [ |], MaxTest = 10000)>] + [ |])>] module ``Component min and max`` = // [] @@ -637,7 +637,7 @@ module Vector3 = Assert.True(isComponentLargest vMax.Y v1.Y v2.Y) Assert.True(isComponentLargest vMax.Z v1.Z v2.Z) - [ |], MaxTest = 10000)>] + [ |])>] module Clamping = // [] @@ -664,7 +664,7 @@ module Vector3 = Assert.Equal(expY, res.Y) Assert.Equal(expZ, res.Z) - [ |], MaxTest = 10000)>] + [ |])>] module ``Unit vectors``= // [] @@ -697,7 +697,7 @@ module Vector3 = Assert.Equal(Vector3.One, unitOne) - [ |], MaxTest = 10000)>] + [ |])>] module Serialization = // [] @@ -707,7 +707,7 @@ module Vector3 = Assert.Equal(expectedSize, Vector3.SizeInBytes) Assert.Equal(expectedSize, Marshal.SizeOf(Vector3())) - [ |], MaxTest = 10000)>] + [ |])>] module Transformation = // [] @@ -718,7 +718,7 @@ module Vector3 = let transformedQuat = q * vectorQuat * inverse let transformedVector = transformedQuat.Xyz - Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(v, q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector3.Transform(v, q)) [] let ``Transformation by quaternion by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector3, q : Quaternion) = @@ -728,7 +728,7 @@ module Vector3 = let transformedQuat = q * vectorQuat * inverse let transformedVector = transformedQuat.Xyz - Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(ref v, ref q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector3.Transform(ref v, ref q)) [] let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector3, q : Quaternion) = @@ -738,7 +738,7 @@ module Vector3 = let transformedQuat = q * vectorQuat * inverse let transformedVector = transformedQuat.Xyz - Assert.ApproximatelyEqual(transformedVector, q * v) + Assert.ApproximatelyEquivalent(transformedVector, q * v) [] let ``Transformation by identity quaternion does not alter vector`` (v : Vector3) = @@ -749,6 +749,6 @@ module Vector3 = let transformedQuat = q * vectorQuat * inverse let transformedVector = transformedQuat.Xyz - Assert.ApproximatelyEqual(v, transformedVector) - Assert.ApproximatelyEqual(v, Vector3.Transform(v, q)) - Assert.ApproximatelyEqual(transformedVector, Vector3.Transform(v, q)) \ No newline at end of file + Assert.ApproximatelyEquivalent(v, transformedVector) + Assert.ApproximatelyEquivalent(v, Vector3.Transform(v, q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector3.Transform(v, q)) \ No newline at end of file diff --git a/tests/OpenTK.Tests/Vector4Tests.fs b/tests/OpenTK.Tests/Vector4Tests.fs index df8a9b6e..a7fce208 100644 --- a/tests/OpenTK.Tests/Vector4Tests.fs +++ b/tests/OpenTK.Tests/Vector4Tests.fs @@ -8,7 +8,7 @@ open System.Runtime.InteropServices open OpenTK module Vector4 = - [ |], MaxTest = 10000)>] + [ |])>] module Constructors = // [] @@ -85,7 +85,7 @@ module Vector4 = Assert.Equal(z, v2.Z) Assert.Equal(w, v2.W) - [ |], MaxTest = 10000)>] + [ |])>] module Indexing = // [] @@ -121,7 +121,7 @@ module Vector4 = (fun() -> v.[4] |> ignore) |> Assert.ThrowsIndexExn - [ |], MaxTest = 10000)>] + [ |])>] module Length = // [] @@ -145,7 +145,7 @@ module Vector4 = Assert.Equal(lsq, v.LengthSquared) - [ |], MaxTest = 10000)>] + [ |])>] module Normalization = // [] @@ -157,10 +157,10 @@ module Vector4 = if not (approxEq l 0.0f) then let norm = v.Normalized() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) - Assert.ApproximatelyEqual(v.Z / l, norm.Z) - Assert.ApproximatelyEqual(v.W / l, norm.W) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.Z / l, norm.Z) + Assert.ApproximatelyEquivalent(v.W / l, norm.W) [] let ``Normalization of instance transforms the instance into a unit length vector with the correct components`` (x, y, z, w) = @@ -172,10 +172,10 @@ module Vector4 = let norm = Vector4(x, y, z, w) norm.Normalize() - Assert.ApproximatelyEqual(v.X / l, norm.X) - Assert.ApproximatelyEqual(v.Y / l, norm.Y) - Assert.ApproximatelyEqual(v.Z / l, norm.Z) - Assert.ApproximatelyEqual(v.W / l, norm.W) + Assert.ApproximatelyEquivalent(v.X / l, norm.X) + Assert.ApproximatelyEquivalent(v.Y / l, norm.Y) + Assert.ApproximatelyEquivalent(v.Z / l, norm.Z) + Assert.ApproximatelyEquivalent(v.W / l, norm.W) [] let ``Fast approximate normalization of instance transforms the instance into a unit length vector with the correct components`` (x, y, z, w) = @@ -185,10 +185,10 @@ module Vector4 = let scale = MathHelper.InverseSqrtFast(x * x + y * y + z * z + w * w) - Assert.ApproximatelyEqual(v.X * scale, norm.X) - Assert.ApproximatelyEqual(v.Y * scale, norm.Y) - Assert.ApproximatelyEqual(v.Z * scale, norm.Z) - Assert.ApproximatelyEqual(v.W * scale, norm.W) + Assert.ApproximatelyEquivalent(v.X * scale, norm.X) + Assert.ApproximatelyEquivalent(v.Y * scale, norm.Y) + Assert.ApproximatelyEquivalent(v.Z * scale, norm.Z) + Assert.ApproximatelyEquivalent(v.W * scale, norm.W) [] let ``Normalization by reference is the same as division by magnitude`` (a : Vector4) = @@ -197,7 +197,7 @@ module Vector4 = let norm = a / a.Length let vRes = Vector4.Normalize(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Normalization is the same as division by magnitude`` (a : Vector4) = @@ -205,7 +205,7 @@ module Vector4 = if not (approxEq a.Length 0.0f) then let norm = a / a.Length - Assert.ApproximatelyEqual(norm, Vector4.Normalize(a)); + Assert.ApproximatelyEquivalent(norm, Vector4.Normalize(a)); [] let ``Fast approximate normalization by reference is the same as multiplication by the fast inverse square`` (a : Vector4) = @@ -214,40 +214,40 @@ module Vector4 = let norm = a * scale let vRes = Vector4.NormalizeFast(ref a) - Assert.ApproximatelyEqual(norm, vRes) + Assert.ApproximatelyEquivalent(norm, vRes) [] let ``Fast approximate normalization is the same as multiplication by the fast inverse square`` (a : Vector4) = let scale = MathHelper.InverseSqrtFast(a.X * a.X + a.Y * a.Y + a.Z * a.Z + a.W * a.W) let norm = a * scale - Assert.ApproximatelyEqual(norm, Vector4.NormalizeFast(a)); + Assert.ApproximatelyEquivalent(norm, Vector4.NormalizeFast(a)); - [ |], MaxTest = 10000)>] + [ |])>] module Addition = // [] let ``Vector4 addition is the same as component addition`` (a : Vector4, b : Vector4) = let c = a + b - Assert.ApproximatelyEqual(a.X + b.X,c.X) - Assert.ApproximatelyEqual(a.Y + b.Y,c.Y) - Assert.ApproximatelyEqual(a.Z + b.Z,c.Z) - Assert.ApproximatelyEqual(a.W + b.W,c.W) + Assert.ApproximatelyEquivalent(a.X + b.X,c.X) + Assert.ApproximatelyEquivalent(a.Y + b.Y,c.Y) + Assert.ApproximatelyEquivalent(a.Z + b.Z,c.Z) + Assert.ApproximatelyEquivalent(a.W + b.W,c.W) [] let ``Vector4 addition is commutative`` (a : Vector4, b : Vector4) = let c = a + b let c2 = b + a - Assert.ApproximatelyEqual(c, c2) + Assert.ApproximatelyEquivalent(c, c2) [] let ``Vector4 addition is associative`` (a : Vector4, b : Vector4, c : Vector4) = let r1 = (a + b) + c let r2 = a + (b + c) - Assert.ApproximatelyEqual(r1, r2) + Assert.ApproximatelyEquivalent(r1, r2) [] let ``Static Vector4 addition method is the same as component addition`` (a : Vector4, b : Vector4) = @@ -255,7 +255,7 @@ module Vector4 = let v1 = Vector4(a.X + b.X, a.Y + b.Y, a.Z + b.Z, a.W + b.W) let sum = Vector4.Add(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4 addition method by reference is the same as component addition`` (a : Vector4, b : Vector4) = @@ -263,9 +263,9 @@ module Vector4 = let v1 = Vector4(a.X + b.X, a.Y + b.Y, a.Z + b.Z, a.W + b.W) let sum = Vector4.Add(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Subtraction = // [] @@ -283,7 +283,7 @@ module Vector4 = let v1 = Vector4(a.X - b.X, a.Y - b.Y, a.Z - b.Z, a.W - b.W) let sum = Vector4.Subtract(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4 subtraction method by reference is the same as component addition`` (a : Vector4, b : Vector4) = @@ -291,9 +291,9 @@ module Vector4 = let v1 = Vector4(a.X - b.X, a.Y - b.Y, a.Z - b.Z, a.W - b.W) let sum = Vector4.Subtract(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Multiplication = // [] @@ -371,7 +371,7 @@ module Vector4 = let v1 = Vector4(a.X * b.X, a.Y * b.Y, a.Z * b.Z, a.W * b.W) let sum = Vector4.Multiply(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4 multiplication method by reference is the same as component multiplication`` (a : Vector4, b : Vector4) = @@ -379,9 +379,9 @@ module Vector4 = let v1 = Vector4(a.X * b.X, a.Y * b.Y, a.Z * b.Z, a.W * b.W) let sum = Vector4.Multiply(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Division = // [] @@ -389,10 +389,10 @@ module Vector4 = if not (approxEq f 0.0f) then // we don't support diving by zero. let r = a / f - Assert.ApproximatelyEqual(a.X / f, r.X) - Assert.ApproximatelyEqual(a.Y / f, r.Y) - Assert.ApproximatelyEqual(a.Z / f, r.Z) - Assert.ApproximatelyEqual(a.W / f, r.W) + Assert.ApproximatelyEquivalent(a.X / f, r.X) + Assert.ApproximatelyEquivalent(a.Y / f, r.Y) + Assert.ApproximatelyEquivalent(a.Z / f, r.Z) + Assert.ApproximatelyEquivalent(a.W / f, r.W) [] let ``Static Vector4-Vector4 division method is the same as component division`` (a : Vector4, b : Vector4) = @@ -400,7 +400,7 @@ module Vector4 = let v1 = Vector4(a.X / b.X, a.Y / b.Y, a.Z / b.Z, a.W / b.W) let sum = Vector4.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4-Vector4 divison method by reference is the same as component division`` (a : Vector4, b : Vector4) = @@ -408,7 +408,7 @@ module Vector4 = let v1 = Vector4(a.X / b.X, a.Y / b.Y, a.Z / b.Z, a.W / b.W) let sum = Vector4.Divide(ref a, ref b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4-scalar division method is the same as component division`` (a : Vector4, b : float32) = @@ -416,7 +416,7 @@ module Vector4 = let v1 = Vector4(a.X / b, a.Y / b, a.Z / b, a.W / b) let sum = Vector4.Divide(a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) [] let ``Static Vector4-scalar divison method by reference is the same as component division`` (a : Vector4, b : float32) = @@ -424,9 +424,9 @@ module Vector4 = let v1 = Vector4(a.X / b, a.Y / b, a.Z / b, a.W / b) let sum = Vector4.Divide(ref a, b) - Assert.ApproximatelyEqual(v1, sum) + Assert.ApproximatelyEquivalent(v1, sum) - [ |], MaxTest = 10000)>] + [ |])>] module Negation = // [] @@ -438,7 +438,7 @@ module Vector4 = Assert.Equal(-z, vNeg.Z) Assert.Equal(-w, vNeg.W) - [ |], MaxTest = 10000)>] + [ |])>] module Equality = // [] @@ -478,7 +478,7 @@ module Vector4 = Assert.False(inequalityByOtherType) - [ |], MaxTest = 10000)>] + [ |])>] module Swizzling = // [] @@ -657,7 +657,7 @@ module Vector4 = Assert.Equal(wy, v.Wy) Assert.Equal(wz, v.Wz) - [ |], MaxTest = 10000)>] + [ |])>] module Interpolation = // [] @@ -686,7 +686,7 @@ module Vector4 = let vRes = Vector4.BaryCentric(ref a, ref b, ref c, u, v) Assert.Equal(r, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module ``Vector products`` = // [] @@ -698,7 +698,7 @@ module Vector4 = let vRes = Vector4.Dot(ref a, ref b) Assert.Equal(dot, vRes) - [ |], MaxTest = 10000)>] + [ |])>] module ``Magnitude min and max`` = // [] @@ -765,7 +765,7 @@ module Vector4 = let v2LongerThanv1 = l2 > l1 Assert.True(v2LongerThanv1) - [ |], MaxTest = 10000)>] + [ |])>] module ``Component min and max`` = // [] @@ -809,7 +809,7 @@ module Vector4 = Assert.True(isComponentLargest vMax.W v1.W v2.W) - [ |], MaxTest = 10000)>] + [ |])>] module Clamping = // [] @@ -840,7 +840,7 @@ module Vector4 = Assert.Equal(expZ, res.Z) Assert.Equal(expW, res.W) - [ |], MaxTest = 10000)>] + [ |])>] module ``Unit vectors``= // [] @@ -879,7 +879,7 @@ module Vector4 = Assert.Equal(Vector4.One, unitOne) - [ |], MaxTest = 10000)>] + [ |])>] module Serialization = // [] @@ -889,7 +889,7 @@ module Vector4 = Assert.Equal(expectedSize, Vector4.SizeInBytes) Assert.Equal(expectedSize, Marshal.SizeOf(Vector4())) - [ |], MaxTest = 10000)>] + [ |])>] module Transformation = // [] @@ -900,7 +900,7 @@ module Vector4 = let transformedQuat = q * vectorQuat * inverse let transformedVector = Vector4(transformedQuat.X, transformedQuat.Y, transformedQuat.Z, transformedQuat.W) - Assert.ApproximatelyEqual(transformedVector, Vector4.Transform(v, q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector4.Transform(v, q)) [] let ``Transformation by quaternion with static method by reference is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) = @@ -910,7 +910,7 @@ module Vector4 = let transformedQuat = q * vectorQuat * inverse let transformedVector = Vector4(transformedQuat.X, transformedQuat.Y,transformedQuat.Z, transformedQuat.W) - Assert.ApproximatelyEqual(transformedVector, Vector4.Transform(ref v, ref q)) + Assert.ApproximatelyEquivalent(transformedVector, Vector4.Transform(ref v, ref q)) [] let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector4, q : Quaternion) = @@ -920,4 +920,4 @@ module Vector4 = let transformedQuat = q * vectorQuat * inverse let transformedVector = Vector4(transformedQuat.X, transformedQuat.Y, transformedQuat.Z, transformedQuat.W) - Assert.ApproximatelyEqual(transformedVector, q * v) \ No newline at end of file + Assert.ApproximatelyEquivalent(transformedVector, q * v) \ No newline at end of file