use double run_corner_cases function in add unit test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Feb 2019 21:23:52 +0000 (21:23 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Feb 2019 21:23:52 +0000 (21:23 +0000)
src/add/test_add64.py

index 71570f53d985580784cdf4a99d720f392cfd3ba9..5890251b9211cc80bffa4368a1510474bc34fb74 100644 (file)
@@ -12,7 +12,7 @@ from random import seed
 from unit_test_double import (get_mantissa, get_exponent, get_sign, is_nan,
                                 is_inf, is_pos_inf, is_neg_inf,
                                 match, get_case, check_case, run_test,
-                                run_edge_cases)
+                                run_edge_cases, run_corner_cases)
 
 
 def testbench(dut):
@@ -35,28 +35,7 @@ def testbench(dut):
     count += len(stimulus_a)
     print (count, "vectors passed")
 
-    #corner cases
-    from itertools import permutations
-    stimulus_a = [i[0] for i in permutations([
-        0x8000000000000000,
-        0x0000000000000000,
-        0x7ff8000000000000,
-        0xfff8000000000000,
-        0x7ff0000000000000,
-        0xfff0000000000000
-    ], 2)]
-    stimulus_b = [i[1] for i in permutations([
-        0x8000000000000000,
-        0x0000000000000000,
-        0x7ff8000000000000,
-        0xfff8000000000000,
-        0x7ff0000000000000,
-        0xfff0000000000000
-    ], 2)]
-    yield from run_test(dut, stimulus_a, stimulus_b, add)
-    count += len(stimulus_a)
-    print (count, "vectors passed")
-
+    yield from run_corner_cases(dut, count, add)
     yield from run_edge_cases(dut, count, add)