From ae1dc08c3e03c5f333c5d8af726ff59757454d48 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 15 Feb 2019 13:19:03 +0000 Subject: [PATCH] add extra unit tests (infinity / NaN) --- src/add/test_add.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/add/test_add.py b/src/add/test_add.py index daa79d36..ce67f63e 100644 --- a/src/add/test_add.py +++ b/src/add/test_add.py @@ -46,16 +46,25 @@ def check_case(dut, a, b, z): assert out_z == z, "Output z 0x%x not equal to expected 0x%x" % (out_z, z) def testbench(dut): - yield from check_case(dut, 0, 0, 0) - yield from check_case(dut, 0x3F800000, 0x40000000, 0x40400000) - yield from check_case(dut, 0x40000000, 0x3F800000, 0x40400000) - yield from check_case(dut, 0x447A0000, 0x4488B000, 0x4502D800) - yield from check_case(dut, 0x463B800A, 0x42BA8A3D, 0x463CF51E) - yield from check_case(dut, 0x42BA8A3D, 0x463B800A, 0x463CF51E) - yield from check_case(dut, 0x463B800A, 0xC2BA8A3D, 0x463A0AF6) - yield from check_case(dut, 0xC2BA8A3D, 0x463B800A, 0x463A0AF6) - yield from check_case(dut, 0xC63B800A, 0x42BA8A3D, 0xC63A0AF6) - yield from check_case(dut, 0x42BA8A3D, 0xC63B800A, 0xC63A0AF6) + #yield from check_case(dut, 0, 0, 0) + #yield from check_case(dut, 0x3F800000, 0x40000000, 0x40400000) + #yield from check_case(dut, 0x40000000, 0x3F800000, 0x40400000) + #yield from check_case(dut, 0x447A0000, 0x4488B000, 0x4502D800) + #yield from check_case(dut, 0x463B800A, 0x42BA8A3D, 0x463CF51E) + #yield from check_case(dut, 0x42BA8A3D, 0x463B800A, 0x463CF51E) + #yield from check_case(dut, 0x463B800A, 0xC2BA8A3D, 0x463A0AF6) + #yield from check_case(dut, 0xC2BA8A3D, 0x463B800A, 0x463A0AF6) + #yield from check_case(dut, 0xC63B800A, 0x42BA8A3D, 0xC63A0AF6) + #yield from check_case(dut, 0x42BA8A3D, 0xC63B800A, 0xC63A0AF6) + yield from check_case(dut, 0xFFFFFFFF, 0xC63B800A, 0xFFC00000) + yield from check_case(dut, 0x7F800000, 0x00000000, 0x7F800000) + yield from check_case(dut, 0x00000000, 0x7F800000, 0x7F800000) + yield from check_case(dut, 0xFF800000, 0x00000000, 0xFF800000) + yield from check_case(dut, 0x00000000, 0xFF800000, 0xFF800000) + yield from check_case(dut, 0x7F800000, 0x7F800000, 0x7F800000) + yield from check_case(dut, 0xFF800000, 0xFF800000, 0xFF800000) + yield from check_case(dut, 0x7F800000, 0xFF800000, 0xFFC00000) + yield from check_case(dut, 0xFF800000, 0x7F800000, 0x7FC00000) #yield from check_case(dut, 1, 0, 1) #yield from check_case(dut, 1, 1, 1) -- 2.30.2