Fix compile inference error under VS2015
authorvaron <varon@users.noreply.github.com>
Fri, 2 Jun 2017 11:48:29 +0000 (13:48 +0200)
committervaron <varon@users.noreply.github.com>
Fri, 2 Jun 2017 11:48:29 +0000 (13:48 +0200)
tests/OpenTK.Tests/Assertions.fs
tests/OpenTK.Tests/Matrix4Tests.fs
tests/OpenTK.Tests/Vector2Tests.fs
tests/OpenTK.Tests/Vector3Tests.fs

index e4e1c41..f47e7ee 100644 (file)
@@ -29,3 +29,6 @@ type internal Assert =
 
     static member ApproximatelyEqual(a : float32,b : float32) =
         if not <| approxEq a b then raise <| new Xunit.Sdk.EqualException(a,b)
+
+
+    static member ThrowsIndexExn(f:unit -> unit) = Assert.Throws<IndexOutOfRangeException>(f) |> ignore
index a025d7e..706a839 100644 (file)
@@ -333,31 +333,35 @@ module Matrix4 =
             Assert.Equal(o, A.[3, 2])
             Assert.Equal(p, A.[3, 3])
 
+
         [<Property>]
         let ``Indexed set operator throws exception for negative indices`` (b : Matrix4, x : float32) =
             let mutable a = b
-            (fun() -> a.[-1, 2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> a.[1, -2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> a.[-1, -2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+
+            
+
+            (fun() -> a.[-1, 2] <- x) |> Assert.ThrowsIndexExn
+            (fun() -> a.[1, -2] <- x) |> Assert.ThrowsIndexExn
+            (fun() -> a.[-1, -2] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for negative indices`` (a : Matrix4) =
-            (fun() -> a.[-1, 2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> a.[1, -2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> a.[-1, -2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> a.[-1, 2] |> ignore) |> Assert.ThrowsIndexExn
+            (fun() -> a.[1, -2] |> ignore) |> Assert.ThrowsIndexExn
+            (fun() -> a.[-1, -2] |> ignore) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed set operator throws exception for large indices`` (a : Matrix4, x : float32) =
             let mutable b = a
-            (fun() -> b.[5, 2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> b.[1, 6] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
-            (fun() -> b.[7, 12] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> b.[5, 2] <- x) |> Assert.ThrowsIndexExn
+            (fun() -> b.[1, 6] <- x) |> Assert.ThrowsIndexExn
+            (fun() -> b.[7, 12] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for large indices`` (a : Matrix4) =
-            (fun() -> a.[5, 2] |> ignore) |> Assert.Throws<IndexOutOfRangeException>  |> ignore
-            (fun() -> a.[1, 6] |> ignore) |> Assert.Throws<IndexOutOfRangeException>  |> ignore
-            (fun() -> a.[7, 12] |> ignore) |> Assert.Throws<IndexOutOfRangeException>  |> ignore
+            (fun() -> a.[5, 2] |> ignore) |> Assert.ThrowsIndexExn
+            (fun() -> a.[1, 6] |> ignore) |> Assert.ThrowsIndexExn
+            (fun() -> a.[7, 12] |> ignore) |> Assert.ThrowsIndexExn
 
     [<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
     module ``Row and column properties`` =
index fccdbc6..724bc55 100644 (file)
@@ -106,25 +106,25 @@ module Vector2 =
         let ``Indexed set operator throws exception for negative indices`` (x, y) =
             let mutable v = Vector2(x, y)
 
-            (fun() -> v.[-1] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[-1] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for negative indices`` (x, y) =
             let mutable v = Vector2(x, y)
 
-            (fun() -> v.[-1] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[-1] |> ignore) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed set operator throws exception for large indices`` (x, y) =
             let mutable v = Vector2(x, y)
 
-            (fun() -> v.[2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[2] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for large indices`` (x, y) =
             let mutable v = Vector2(x, y)
 
-            (fun() -> v.[2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[2] |> ignore) |> Assert.ThrowsIndexExn
 
     [<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
     module ``Simple Properties`` =
@@ -574,17 +574,6 @@ module Vector2 =
 
             Assert.Equal(transformedVector, Vector2.Transform(ref v, ref q))
 
-// TODO: Implement multiplication operator for Vector2 and Quaternion
-//        [<Property>]
-//        let ``Transformation by quaternion by multiplication using right-handed notation is the same as multiplication by quaternion and its conjugate`` (v : Vector2, q : Quaternion) =
-//            let vectorQuat = Quaternion(v.X, v.Y, 0.0f, 0.0f)
-//            let inverse = Quaternion.Invert(q)
-//
-//            let transformedQuat = q * vectorQuat * inverse
-//            let transformedVector = Vector2(transformedQuat.X, transformedQuat.Y)
-//
-//            Assert.Equal(transformedVector, q * v)
-
     [<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
     module Serialization =
         //
index 851358c..9f89ba4 100644 (file)
@@ -80,25 +80,25 @@ module Vector3 =
         let ``Indexed set operator throws exception for negative indices`` (x, y, z) =
             let mutable v = Vector3(x, y, z)
 
-            (fun() -> v.[-1] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[-1] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for negative indices`` (x, y, z) =
             let mutable v = Vector3(x, y, z)
 
-            (fun() -> v.[-1] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[-1] |> ignore) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed set operator throws exception for large indices`` (x, y, z) =
             let mutable v = Vector3(x, y, z)
 
-            (fun() -> v.[4] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[4] <- x) |> Assert.ThrowsIndexExn
 
         [<Property>]
         let ``Indexed get operator throws exception for large indices`` (x, y, z) =
             let mutable v = Vector3(x, y, z)
 
-            (fun() -> v.[4] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
+            (fun() -> v.[4] |> ignore) |> Assert.ThrowsIndexExn
 
     [<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
     module Length =