[Piglit] [PATCH v2 1/1] cl: Add copysign tests

Jan Vesely jan.vesely at rutgers.edu
Tue Sep 2 16:45:22 PDT 2014


v2: Fix -NaN test

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---

yes, you're right, thx for noticing that.
Although I was not sure whether copysign (-4.0, nan) should not return 4.0

jan

 generated_tests/generate-cl-math-builtins.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/generated_tests/generate-cl-math-builtins.py b/generated_tests/generate-cl-math-builtins.py
index a20f921..aaca8b7 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -24,13 +24,14 @@
 
 import os
 
-from genclbuiltins import gen
+from genclbuiltins import gen, NEGNAN
 from math import acos, atan, pi, sin, sqrt, cos
 
 CLC_VERSION_MIN = {
     'acos' : 10,
     'atan' : 10,
     'ceil' : 10,
+    'copysign' : 10,
     'cos' : 10,
     'floor' : 10,
     'mix' : 10,
@@ -75,6 +76,15 @@ tests = {
             [0.5, -0.5, 0.0, -0.0, float("nan"), -3.99]
         ]
     },
+    'copysign' : {
+        'arg_types': [F, F, F],
+        'function_type': 'ttt',
+        'values': [
+            [0.0, -0.0, 1.0, -1.0, float("nan"), float("nan"), NEGNAN,       float("-inf"), float("inf") ], # Result
+            [0.0,  0.0, 1.0, -1.0, float("nan"), -4.0,         float("nan"), float("inf"),  float("-inf") ], # Arg0
+            [1.0, -1.0, 2.0, -2.0, float("nan"), float("nan"), -4.0,         -3.0,          float("inf") ], # Arg1
+        ]
+    },
     'cos' : {
         'arg_types' : [F, F],
         'function_type': 'ttt',
-- 
1.9.3



More information about the Piglit mailing list