From: Luke Kenneth Casson Leighton Date: Fri, 15 Feb 2019 09:28:29 +0000 (+0000) Subject: improve assertion output for unit test X-Git-Tag: ls180-24jan2020~1985 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2716ffa5e594d7a993218ab45aa9534df3cac201;p=ieee754fpu.git improve assertion output for unit test --- diff --git a/src/add/test_add.py b/src/add/test_add.py index 7769bb28..d53cae8e 100644 --- a/src/add/test_add.py +++ b/src/add/test_add.py @@ -16,7 +16,7 @@ class ORGate: return m -def check_case(dut, a, b, x): +def check_case(dut, a, b, z): yield dut.in_a.eq(a) yield dut.in_a_stb.eq(1) yield @@ -42,6 +42,9 @@ def check_case(dut, a, b, x): yield break + out_z = yield dut.out_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)