summaryrefslogtreecommitdiff
path: root/generated_tests
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2015-02-20 13:58:02 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2015-02-23 15:47:10 -0800
commitd5bb562cc39a81463cf502ea08dea2ed7062541e (patch)
tree91edd04bd654a006377bbc9f67e92fa78e31d071 /generated_tests
parent7edd21336a1fa3292ff9b94c1b27a17be966ce98 (diff)
genclbuiltins.py: hybridize for python3
This allows gen_cl_int_builtins, gen_cl_math_builtins, and gen_cl_relational_tests to generate tests with python3 and python2, and to produce the same output Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'generated_tests')
-rw-r--r--generated_tests/genclbuiltins.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 77585475f..5ebb352f2 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -1,7 +1,11 @@
+import os
+
+import six
+
__all__ = ['gen', 'DATA_SIZES', 'MAX_VALUES', 'MAX', 'MIN', 'BMIN', 'BMAX',
'SMIN', 'SMAX', 'UMIN', 'UMAX', 'TYPE', 'T', 'U', 'B']
-import os
+_NUMERIC_TYPES = tuple(list(six.integer_types) + [float])
DATA_SIZES = {
@@ -268,7 +272,7 @@ def getValue(type, val, isVector):
return map(lambda x: getValue(type, x, isVector), val);
# At this point, we should have been passed a number
- if (isinstance(val, (int, long, float))):
+ if (isinstance(val, _NUMERIC_TYPES)):
return val
print('Invalid value '+repr(val)+' encountered in getValue\n')
@@ -373,7 +377,7 @@ def gen(types, minVersions, functions, testDefs, dirName):
for dataType in types:
for fnName in functions:
# Merge all of the generic/signed/unsigned/custom test definitions
- if not testDefs.has_key((dataType, fnName)):
+ if (dataType, fnName) not in testDefs:
continue
functionDef = testDefs[(dataType, fnName)]