[Piglit] [PATCH 4/6] generated_tests/gen_tess_input_tests.py: simplify some of the logic
Dylan Baker
baker.dylan.c at gmail.com
Wed Oct 7 14:27:58 PDT 2015
This produces the same result, but it's much clearer what's happening.
---
generated_tests/gen_tess_input_tests.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/generated_tests/gen_tess_input_tests.py b/generated_tests/gen_tess_input_tests.py
index f4c50e6..4950976 100644
--- a/generated_tests/gen_tess_input_tests.py
+++ b/generated_tests/gen_tess_input_tests.py
@@ -143,8 +143,7 @@ class TcsTest(object):
elif self.var_type.startswith('u'):
rand = lambda: np.random.randint(0, 0xffffffff)
else:
- rand = lambda: ((np.int_(-1) + np.int_(2) *
- np.random.randint(0, 1)) *
+ rand = lambda: (np.int_(np.random.choice((-1, 1))) *
np.random.randint(0, 2**23-1) *
np.float_(2.0)**(np.random.randint(-126, 127)))
@@ -306,8 +305,7 @@ class TesTest(object):
elif self.var_type.startswith('u'):
rand = lambda: np.random.randint(0, 0xffffffff)
else:
- rand = lambda: ((np.int_(-1) + np.int_(2) *
- np.random.randint(0, 1)) *
+ rand = lambda: (np.int_(np.random.choice((-1, 1))) *
np.random.randint(0, 2**23-1) *
np.float_(2.0)**(np.random.randint(-126, 127)))
--
2.6.1
More information about the Piglit
mailing list