From: whitequark Date: Sat, 2 Oct 2021 13:18:11 +0000 (+0000) Subject: hdl.ast: add tests for casting bare integers in {Cat,Repl}. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65499d5c45a2025b198ba2be9f3c694b028e3d30;p=nmigen.git hdl.ast: add tests for casting bare integers in {Cat,Repl}. --- diff --git a/tests/test_hdl_ast.py b/tests/test_hdl_ast.py index b349231..9f0fec6 100644 --- a/tests/test_hdl_ast.py +++ b/tests/test_hdl_ast.py @@ -737,6 +737,10 @@ class CatTestCase(FHDLTestCase): c1 = Cat(Const(10), Const(1)) self.assertEqual(repr(c1), "(cat (const 4'd10) (const 1'd1))") + def test_cast(self): + c = Cat(1, 0) + self.assertEqual(repr(c), "(cat (const 1'd1) (const 1'd0))") + class ReplTestCase(FHDLTestCase): def test_shape(self): @@ -756,6 +760,10 @@ class ReplTestCase(FHDLTestCase): s = Repl(Const(10), 3) self.assertEqual(repr(s), "(repl (const 4'd10) 3)") + def test_cast(self): + r = Repl(0, 3) + self.assertEqual(repr(r), "(repl (const 1'd0) 3)") + class ArrayTestCase(FHDLTestCase): def test_acts_like_array(self):