hdl.rec: make Record inherit from UserValue.

Closes #354.
This commit is contained in:
anuejn 2020-04-16 18:46:55 +02:00 committed by GitHub
parent b4af217ed0
commit ff6c0327a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 24 deletions

View file

@ -916,6 +916,14 @@ class UserValueTestCase(FHDLTestCase):
self.assertEqual(uv.shape(), unsigned(1))
self.assertEqual(uv.lower_count, 1)
def test_lower_to_user_value(self):
uv = MockUserValue(MockUserValue(1))
self.assertEqual(uv.shape(), unsigned(1))
self.assertIsInstance(uv.shape(), Shape)
uv.lowered = MockUserValue(2)
self.assertEqual(uv.shape(), unsigned(1))
self.assertEqual(uv.lower_count, 1)
class SampleTestCase(FHDLTestCase):
def test_const(self):

View file

@ -620,3 +620,12 @@ class UserValueTestCase(FHDLTestCase):
)
)
""")
class UserValueRecursiveTestCase(UserValueTestCase):
def setUp(self):
self.s = Signal()
self.c = Signal()
self.uv = MockUserValue(MockUserValue(self.s))
# inherit the test_lower method from UserValueTestCase because the checks are the same