hdl._ast: enforce the ShapeCastable.const contract in Const().
This commit is contained in:
parent
5577f4e703
commit
c4bbcc6f8a
5 changed files with 18 additions and 11 deletions
|
|
@ -522,10 +522,16 @@ class ConstTestCase(FHDLTestCase):
|
|||
hash(Const(0))
|
||||
|
||||
def test_shape_castable(self):
|
||||
class MockConstValue:
|
||||
class MockConstValue(ValueCastable):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def shape(self):
|
||||
return MockConstShape()
|
||||
|
||||
def as_value(self):
|
||||
return Const(self.value, 8)
|
||||
|
||||
class MockConstShape(ShapeCastable):
|
||||
def as_shape(self):
|
||||
return unsigned(8)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue