yield inversion of zip of test cases
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Jul 2019 11:25:46 +0000 (12:25 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 8 Jul 2019 11:25:46 +0000 (12:25 +0100)
src/ieee754/fpcommon/test/case_gen.py

index 5a1661a159c6c1167cd6580e23ad60aa6bfc7457..cbccd923bacba27a7509bb5d1498b8da4e874720 100644 (file)
@@ -32,7 +32,8 @@ def get_rval(width):
 def get_rand1(mod, fixed_num, maxcount, width):
     stimulus_a = replicate(fixed_num, maxcount)
     stimulus_b = [get_rval(width) for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 def get_nan_noncan(mod, fixed_num, maxcount, width):
@@ -40,7 +41,8 @@ def get_nan_noncan(mod, fixed_num, maxcount, width):
     # non-canonical NaNs.
     stimulus_b = [mod.set_exponent(get_rval(width), mod.max_e) \
                         for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 def get_n127(mod, fixed_num, maxcount, width):
@@ -48,7 +50,8 @@ def get_n127(mod, fixed_num, maxcount, width):
     # -127
     stimulus_b = [mod.set_exponent(get_rval(width), -mod.max_e+1) \
                         for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 def get_nearly_zero(mod, fixed_num, maxcount, width):
@@ -56,7 +59,8 @@ def get_nearly_zero(mod, fixed_num, maxcount, width):
     # nearly zero
     stimulus_b = [mod.set_exponent(get_rval(width), -mod.max_e+2) \
                         for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 def get_nearly_inf(mod, fixed_num, maxcount, width):
@@ -64,14 +68,16 @@ def get_nearly_inf(mod, fixed_num, maxcount, width):
     # nearly inf
     stimulus_b = [mod.set_exponent(get_rval(width), mod.max_e-1) \
                         for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 def get_corner_rand(mod, fixed_num, maxcount, width):
     stimulus_a = replicate(fixed_num, maxcount)
     # random
     stimulus_b = [get_rval(width) for i in range(maxcount)]
-    return zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_a, stimulus_b)
+    yield from zip(stimulus_b, stimulus_a)
 
 
 class PipeFPCase: