From 2716ffa5e594d7a993218ab45aa9534df3cac201 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 15 Feb 2019 09:28:29 +0000 Subject: [PATCH] improve assertion output for unit test --- src/add/test_add.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.30.2