From 268fcd9d5ea8cd741d6078a54f99c01d78fd850f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 18 Feb 2019 21:04:29 +0000 Subject: [PATCH] add corner case unit test function --- src/add/unit_test_single.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/add/unit_test_single.py b/src/add/unit_test_single.py index b2396131..a752189f 100644 --- a/src/add/unit_test_single.py +++ b/src/add/unit_test_single.py @@ -114,6 +114,16 @@ def run_test(dut, stimulus_a, stimulus_b, op): sys.exit(0) +def run_corner_cases(dut, count, op): + #corner cases + from itertools import permutations + stimulus_a = [i[0] for i in permutations([0x80000000, 0x00000000, 0x7f800000, 0xff800000, 0x7fc00000, 0xffc00000], 2)] + stimulus_b = [i[1] for i in permutations([0x80000000, 0x00000000, 0x7f800000, 0xff800000, 0x7fc00000, 0xffc00000], 2)] + yield from run_test(dut, stimulus_a, stimulus_b, op) + count += len(stimulus_a) + print (count, "vectors passed") + + def run_edge_cases(dut, count, op): #edge cases stimulus_a = [0x80000000 for i in range(1000)] -- 2.30.2