aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit/dom/SimplePackage.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/pyunit/dom/SimplePackage.py')
-rw-r--r--testsuite/pyunit/dom/SimplePackage.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/pyunit/dom/SimplePackage.py b/testsuite/pyunit/dom/SimplePackage.py
new file mode 100644
index 000000000..212e0402d
--- /dev/null
+++ b/testsuite/pyunit/dom/SimplePackage.py
@@ -0,0 +1,31 @@
+from pathlib import Path
+from unittest import TestCase
+
+from pyGHDL.dom.Misc import Design, Document
+
+
+if __name__ == "__main__":
+ print("ERROR: you called a testcase declaration file as an executable module.")
+ print("Use: 'python -m unitest <testcase module>'")
+ exit(1)
+
+
+class SimplePackage(TestCase):
+ _root = Path(__file__).resolve().parent.parent
+ _filename : Path = _root / "SimplePackage.vhdl"
+
+ def test_Package(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
+
+ self.assertEqual(len(design.Documents[0].Packages), 1)
+ self.assertTrue(design.Documents[0].Packages[0].Name == "pack_1")
+
+ def test_PackageBody(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
+
+ self.assertEqual(len(design.Documents[0].PackageBodies), 1)
+ self.assertTrue(design.Documents[0].PackageBodies[0].Name == "pack_1")