namespace OpenTK.Tests open Xunit open FsCheck open FsCheck.Xunit open System open OpenTK module Vector2 = [ |])>] module ``Simple Properties`` = // [] let ``Vector equality is by component`` (a : Vector2,b : Vector2) = // Assert.Equal((a.X = b.X && a.Y = b.Y),(a = b)) [] let ``Vector length is always >= 0`` (a : Vector2) = // Assert.True(a.Length >= 0.0f) [ |])>] 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) [] let ``Vector addition is commutative`` (a : Vector2,b : Vector2) = let c = a + b let c2 = b + a Assert.ApproximatelyEqual(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) [ |])>] module Multiplication = // [] let ``Vector multiplication is the same as component multiplication`` (a : Vector2,b : Vector2) = let c = a * b Assert.Equal(a.X * b.X,c.X) Assert.Equal(a.Y * b.Y,c.Y) [] let ``Vector multiplication is commutative`` (a : Vector2,b : Vector2) = let r1 = a * b let r2 = b * a Assert.Equal(r1,r2) [] let ``Vector-float multiplication is the same as component-float multiplication`` (a : Vector2,f : float32) = let r = a * f Assert.Equal(a.X * f,r.X) Assert.Equal(a.Y * f,r.Y) [ |])>] module Subtraction = // [] let ``Vector subtraction is the same as component subtraction`` (a : Vector2,b : Vector2) = let c = a - b Assert.Equal(a.X - b.X,c.X) Assert.Equal(a.Y - b.Y,c.Y) [ |])>] module Division = // [] let ``Vector-float division is the same as component-float division`` (a : Vector2,f : float32) = let r = a / f Assert.ApproximatelyEqual(a.X / f,r.X) Assert.ApproximatelyEqual(a.Y / f,r.Y)