@@ -44,56 +44,26 @@ let correctnessGenericTest<'a when 'a: struct and 'a: equality> isZero exists (a
4444 $" The results should be the same, vector : {vector}"
4545 |> Expect.equal result ( Array.exists ( not << isZero) array)
4646
47- let testFixtures =
48-
49- let getCorrectnessTestName datatype =
50- sprintf " Correctness on %s , %A " datatype Dense
51-
52- [ let exists =
53- ClArray.exists context wgSize Predicates.isSome
54-
55- correctnessGenericTest< int> ((=) 0 ) exists
56- |> testPropertyWithConfig config ( getCorrectnessTestName " int" )
47+ let createTest < 'a when 'a : struct and 'a : equality > isEqual zero =
48+ let exists =
49+ ClArray.exists context wgSize Predicates.isSome
5750
58- correctnessGenericTest< int > ((=) 0 ) exists ( Array.create 1000 0 )
59- |> testPropertyWithConfig config ( getCorrectnessTestName " int zeros " )
51+ [ correctnessGenericTest< 'a > ( isEqual zero ) exists
52+ |> testPropertyWithConfig config " FSCheck data "
6053
61- let exists =
62- ClArray.exists context wgSize Predicates.isSome
54+ correctnessGenericTest< 'a> ( isEqual zero) exists ( Array.create 1000 zero)
55+ |> testPropertyWithConfig config " Zeros" ]
56+ |> testList $" Correctness on %A {typeof<'a>}"
6357
64- correctnessGenericTest< byte> ((=) 0 uy) exists
65- |> testPropertyWithConfig config ( getCorrectnessTestName " byte" )
66-
67- correctnessGenericTest< byte> ((=) 0 uy) exists ( Array.create 1000 0 uy)
68- |> testPropertyWithConfig config ( getCorrectnessTestName " byte zeros" )
58+ let testFixtures =
59+ [ createTest< int> (=) 0
60+ createTest< byte> (=) 0 uy
6961
7062 if Utils.isFloat64Available context.ClDevice then
71- let exists =
72- ClArray.exists context wgSize Predicates.isSome
73-
74- correctnessGenericTest< float> ((=) 0.0 ) exists
75- |> testPropertyWithConfig config ( getCorrectnessTestName " float" )
76-
77- correctnessGenericTest< float> ((=) 0.0 ) exists ( Array.create 1000 0.0 )
78- |> testPropertyWithConfig config ( getCorrectnessTestName " float zeros" )
79-
80- let exists =
81- ClArray.exists context wgSize Predicates.isSome
82-
83- correctnessGenericTest< float32> ((=) 0.0 f) exists
84- |> testPropertyWithConfig config ( getCorrectnessTestName " float32" )
85-
86- correctnessGenericTest< float32> ((=) 0.0 f) exists ( Array.create 1000 0.0 f)
87- |> testPropertyWithConfig config ( getCorrectnessTestName " float32 zeros" )
88-
89- let exists =
90- ClArray.exists context wgSize Predicates.isSome
91-
92- correctnessGenericTest< bool> ((=) false ) exists
93- |> testPropertyWithConfig config ( getCorrectnessTestName " bool" )
63+ createTest Utils.floatIsEqual 0.0
9464
95- correctnessGenericTest < bool > ((=) false ) exists ( Array.create 1000 false )
96- |> testPropertyWithConfig config ( getCorrectnessTestName " bool zeros " ) ]
65+ createTest < float32 > Utils.float32IsEqual 0.0 f
66+ createTest < bool > (=) false ]
9767
9868let tests =
9969 testList " Backend.Vector.containsNonZero tests" testFixtures
0 commit comments