Fix compile inference error under VS2015

This commit is contained in:
varon 2017-06-02 13:48:29 +02:00
parent 0cd47f2c3c
commit 87dcb3144a
4 changed files with 27 additions and 31 deletions

View 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

View 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`` =

View 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 =
//

View 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 =