From: Luke Kenneth Casson Leighton Date: Mon, 8 Jul 2019 11:25:46 +0000 (+0100) Subject: yield inversion of zip of test cases X-Git-Tag: ls180-24jan2020~874 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7298128c99761ca0e0508b96b7c4faf7f0379df6;p=ieee754fpu.git yield inversion of zip of test cases --- diff --git a/src/ieee754/fpcommon/test/case_gen.py b/src/ieee754/fpcommon/test/case_gen.py index 5a1661a1..cbccd923 100644 --- a/src/ieee754/fpcommon/test/case_gen.py +++ b/src/ieee754/fpcommon/test/case_gen.py @@ -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: