From 237fc003dd9b0b1d149a98198890bdd28f017314 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 15:27:25 +0100 Subject: [PATCH] add abs SelectableInt unit test (very quick) --- src/soc/decoder/selectable_int.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index eebada68..8e0564f6 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -412,6 +412,8 @@ class SelectableIntTestCase(unittest.TestCase): d = a - b e = a * b f = -a + g = abs(f) + h = abs(a) self.assertEqual(c.value, a.value + b.value) self.assertEqual(d.value, (a.value - b.value) & 0xFF) self.assertEqual(e.value, (a.value * b.value) & 0xFF) @@ -419,6 +421,8 @@ class SelectableIntTestCase(unittest.TestCase): self.assertEqual(c.bits, a.bits) self.assertEqual(d.bits, a.bits) self.assertEqual(e.bits, a.bits) + self.assertEqual(a.bits, f.bits) + self.assertEqual(a.bits, h.bits) def test_logic(self): a = SelectableInt(0x0F, 8) -- 2.30.2