mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 13:40:41 +00:00
Merge branch 'nihlus_fscheck_testing2' into fscheck_testing
This commit is contained in:
commit
1a50dc2eb1
|
@ -29,3 +29,6 @@ type internal Assert =
|
||||||
|
|
||||||
static member ApproximatelyEqual(a : float32,b : float32) =
|
static member ApproximatelyEqual(a : float32,b : float32) =
|
||||||
if not <| approxEq a b then raise <| new Xunit.Sdk.EqualException(a,b)
|
if not <| approxEq a b then raise <| new Xunit.Sdk.EqualException(a,b)
|
||||||
|
|
||||||
|
|
||||||
|
static member ThrowsIndexExn(f:unit -> unit) = Assert.Throws<IndexOutOfRangeException>(f) |> ignore
|
||||||
|
|
|
@ -333,31 +333,35 @@ module Matrix4 =
|
||||||
Assert.Equal(o, A.[3, 2])
|
Assert.Equal(o, A.[3, 2])
|
||||||
Assert.Equal(p, A.[3, 3])
|
Assert.Equal(p, A.[3, 3])
|
||||||
|
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed set operator throws exception for negative indices`` (b : Matrix4, x : float32) =
|
let ``Indexed set operator throws exception for negative indices`` (b : Matrix4, x : float32) =
|
||||||
let mutable a = b
|
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>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for negative indices`` (a : Matrix4) =
|
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.ThrowsIndexExn
|
||||||
(fun() -> a.[1, -2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> a.[1, -2] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
(fun() -> a.[-1, -2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> a.[-1, -2] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed set operator throws exception for large indices`` (a : Matrix4, x : float32) =
|
let ``Indexed set operator throws exception for large indices`` (a : Matrix4, x : float32) =
|
||||||
let mutable b = a
|
let mutable b = a
|
||||||
(fun() -> b.[5, 2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> b.[5, 2] <- x) |> Assert.ThrowsIndexExn
|
||||||
(fun() -> b.[1, 6] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> b.[1, 6] <- x) |> Assert.ThrowsIndexExn
|
||||||
(fun() -> b.[7, 12] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> b.[7, 12] <- x) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for large indices`` (a : Matrix4) =
|
let ``Indexed get operator throws exception for large indices`` (a : Matrix4) =
|
||||||
(fun() -> a.[5, 2] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> a.[5, 2] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
(fun() -> a.[1, 6] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> a.[1, 6] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
(fun() -> a.[7, 12] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> a.[7, 12] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
|
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
|
||||||
module ``Row and column properties`` =
|
module ``Row and column properties`` =
|
||||||
|
|
|
@ -106,25 +106,25 @@ module Vector2 =
|
||||||
let ``Indexed set operator throws exception for negative indices`` (x, y) =
|
let ``Indexed set operator throws exception for negative indices`` (x, y) =
|
||||||
let mutable v = Vector2(x, y)
|
let mutable v = Vector2(x, y)
|
||||||
|
|
||||||
(fun() -> v.[-1] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> v.[-1] <- x) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for negative indices`` (x, y) =
|
let ``Indexed get operator throws exception for negative indices`` (x, y) =
|
||||||
let mutable v = Vector2(x, y)
|
let mutable v = Vector2(x, y)
|
||||||
|
|
||||||
(fun() -> v.[-1] |> ignore) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> v.[-1] |> ignore) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed set operator throws exception for large indices`` (x, y) =
|
let ``Indexed set operator throws exception for large indices`` (x, y) =
|
||||||
let mutable v = Vector2(x, y)
|
let mutable v = Vector2(x, y)
|
||||||
|
|
||||||
(fun() -> v.[2] <- x) |> Assert.Throws<IndexOutOfRangeException> |> ignore
|
(fun() -> v.[2] <- x) |> Assert.ThrowsIndexExn
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for large indices`` (x, y) =
|
let ``Indexed get operator throws exception for large indices`` (x, y) =
|
||||||
let mutable v = Vector2(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> |])>]
|
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
|
||||||
module ``Simple Properties`` =
|
module ``Simple Properties`` =
|
||||||
|
@ -574,17 +574,6 @@ module Vector2 =
|
||||||
|
|
||||||
Assert.Equal(transformedVector, Vector2.Transform(ref v, ref q))
|
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> |])>]
|
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
|
||||||
module Serialization =
|
module Serialization =
|
||||||
//
|
//
|
||||||
|
|
|
@ -80,25 +80,25 @@ module Vector3 =
|
||||||
let ``Indexed set operator throws exception for negative indices`` (x, y, z) =
|
let ``Indexed set operator throws exception for negative indices`` (x, y, z) =
|
||||||
let mutable v = Vector3(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>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for negative indices`` (x, y, z) =
|
let ``Indexed get operator throws exception for negative indices`` (x, y, z) =
|
||||||
let mutable v = Vector3(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>]
|
[<Property>]
|
||||||
let ``Indexed set operator throws exception for large indices`` (x, y, z) =
|
let ``Indexed set operator throws exception for large indices`` (x, y, z) =
|
||||||
let mutable v = Vector3(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>]
|
[<Property>]
|
||||||
let ``Indexed get operator throws exception for large indices`` (x, y, z) =
|
let ``Indexed get operator throws exception for large indices`` (x, y, z) =
|
||||||
let mutable v = Vector3(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> |])>]
|
[<Properties(Arbitrary = [| typeof<OpenTKGen> |])>]
|
||||||
module Length =
|
module Length =
|
||||||
|
|
Loading…
Reference in a new issue