@@ -87,25 +87,28 @@ let correctnessGenericTest
8787 | ex when ex.Message = " InvalidBufferSize" -> ()
8888 | ex -> raise ex
8989
90- let createTestMap case ( zero : 'a ) op isEqual opQ map =
90+ let createTestMap case ( zero : 'a ) ( constant : 'a ) binOp isEqual opQ =
9191 let getCorrectnessTestName = getCorrectnessTestName case
9292
9393 let context = case.TestContext.ClContext
9494 let q = case.TestContext.Queue
9595
96- let map = map context opQ wgSize
96+ let unaryOp = binOp constant
97+ let unaryOpQ = opQ zero constant
98+
99+ let map = Matrix.map context unaryOpQ wgSize
97100
98101 let toCOO = Matrix.toCOO context wgSize
99102
100103 case
101- |> correctnessGenericTest zero op map toCOO isEqual q
104+ |> correctnessGenericTest zero unaryOp map toCOO isEqual q
102105 |> testPropertyWithConfig config ( getCorrectnessTestName $" {typeof<'a>}" )
103106
104107let testFixturesMapNot case =
105108 [ let q = case.TestContext.Queue
106109 q.Error.Add( fun e -> failwithf " %A " e)
107110
108- createTestMap case false not (=) ArithmeticOperations.notQ Matrix.map ]
111+ createTestMap case false true ( fun _ -> not ) (=) ( fun _ _ -> ArithmeticOperations.notQ) ]
109112
110113let notTests =
111114 operationGPUTests " Backend.Matrix.map not tests" testFixturesMapNot
@@ -116,11 +119,11 @@ let testFixturesMapAdd case =
116119 q.Error.Add( fun e -> failwithf " %A " e)
117120
118121 if Utils.isFloat64Available context.ClDevice then
119- createTestMap case 0.0 ((+) 10.0 ) Utils.floatIsEqual ( ArithmeticOperations.addLeftConst 0.0 10.0 ) Matrix.map
122+ createTestMap case 0.0 10.0 (+ ) Utils.floatIsEqual ArithmeticOperations.addLeftConst
120123
121- createTestMap case 0.0 f ((+) 10.0 f) Utils.float32IsEqual ( ArithmeticOperations.addLeftConst 0.0 f 10.0 f ) Matrix.map
124+ createTestMap case 0.0 f 10.0 f (+ ) Utils.float32IsEqual ArithmeticOperations.addLeftConst
122125
123- createTestMap case 0 uy (( +) 10 uy ) (=) ( ArithmeticOperations.addLeftConst 0 uy 10 uy ) Matrix.map ]
126+ createTestMap case 0 uy 10 uy ( +) (=) ArithmeticOperations.addLeftConst ]
124127
125128let addTests =
126129 operationGPUTests " Backend.Matrix.map add tests" testFixturesMapAdd
@@ -131,11 +134,11 @@ let testFixturesMapMul case =
131134 q.Error.Add( fun e -> failwithf " %A " e)
132135
133136 if Utils.isFloat64Available context.ClDevice then
134- createTestMap case 0.0 ((*) 10.0 ) Utils.floatIsEqual ( ArithmeticOperations.mulLeftConst 0.0 10.0 ) Matrix.map
137+ createTestMap case 0.0 10.0 (* ) Utils.floatIsEqual ArithmeticOperations.mulLeftConst
135138
136- createTestMap case 0.0 f ((*) 10.0 f) Utils.float32IsEqual ( ArithmeticOperations.mulLeftConst 0.0 f 10.0 f ) Matrix.map
139+ createTestMap case 0.0 f 10.0 f (* ) Utils.float32IsEqual ArithmeticOperations.mulLeftConst
137140
138- createTestMap case 0 uy (( *) 10 uy ) (=) ( ArithmeticOperations.mulLeftConst 0 uy 10 uy ) Matrix.map ]
141+ createTestMap case 0 uy 10 uy ( *) (=) ArithmeticOperations.mulLeftConst ]
139142
140143let mulTests =
141144 operationGPUTests " Backend.Matrix.map mul tests" testFixturesMapMul
0 commit comments