From 139ce38fa6bb0bacc06f6f06dd884d75f9702baf Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 14 Feb 2020 22:04:12 +0000 Subject: [PATCH] fix the shift-test to truncate b-input --- src/ieee754/part/test/test_partsig.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ieee754/part/test/test_partsig.py b/src/ieee754/part/test/test_partsig.py index 8e5ac9fd..43529214 100644 --- a/src/ieee754/part/test/test_partsig.py +++ b/src/ieee754/part/test/test_partsig.py @@ -19,7 +19,7 @@ def first_zero(x): for i in range(16): if x & (1<>fz + sum = ((a & mask) << b) result = mask & sum carry = (sum & mask) != sum carry = 0 - print(a, b, sum, mask) + print("result", hex(a), hex(b), hex(sum), hex(mask), hex(result)) return result, carry def test_add_fn(carry_in, a, b, mask): @@ -171,6 +174,7 @@ class TestPartitionPoints(unittest.TestCase): y = 0 carry_result = 0 for i, mask in enumerate(mask_list): + print ("i/mask", i, hex(mask)) res, c = test_fn(carry, a, b, mask) y |= res lsb = mask & ~(mask - 1) @@ -185,7 +189,7 @@ class TestPartitionPoints(unittest.TestCase): if hasattr(module, "%s_carry_out" % mod_attr): c_outval = (yield getattr(module, "%s_carry_out" % mod_attr)) - msg = f"{msg_prefix}: 0x{a:X} {modattr} 0x{b:X}" + \ + msg = f"{msg_prefix}: 0x{a:X} {mod_attr} 0x{b:X}" + \ f" => 0x{carry_result:X} != 0x{c_outval:X}" self.assertEqual(carry_result, c_outval, msg) -- 2.30.2