fhdl.ast: refactor Operator.shape(). NFC.

This commit is contained in:
whitequark 2018-12-15 09:46:20 +00:00
parent 3a8685c352
commit 46f5addf05
2 changed files with 61 additions and 46 deletions

View file

@ -88,6 +88,11 @@ class ConstTestCase(FHDLTestCase):
class OperatorTestCase(FHDLTestCase):
def test_bool(self):
v = Const(0, 4).bool()
self.assertEqual(repr(v), "(b (const 4'd0))")
self.assertEqual(v.shape(), (1, False))
def test_invert(self):
v = ~Const(0, 4)
self.assertEqual(repr(v), "(~ (const 4'd0))")