diff options
author | tgingold <tgingold@users.noreply.github.com> | 2020-12-29 17:19:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 17:19:09 +0100 |
commit | 7ca54117b8f757396ba5ef04c83ff1228ca94384 (patch) | |
tree | cc5f7f4166cc0570bda5cf2047d3ef7abbc36e37 /testsuite/pyunit/dom/SimpleEntity.py | |
parent | 340fc792bba2ffdb4f930bc427a39ea3a1b659b2 (diff) | |
parent | 50adcf884c3cfa4e33ca45769295f163baa63a3e (diff) | |
download | ghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.tar.gz ghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.tar.bz2 ghdl-7ca54117b8f757396ba5ef04c83ff1228ca94384.zip |
Merge pull request #1556 from Paebbels/paebbels/pyGHDL
Cleanup and Restructuring of pyGHDL
Diffstat (limited to 'testsuite/pyunit/dom/SimpleEntity.py')
-rw-r--r-- | testsuite/pyunit/dom/SimpleEntity.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/pyunit/dom/SimpleEntity.py b/testsuite/pyunit/dom/SimpleEntity.py new file mode 100644 index 000000000..2f65c9813 --- /dev/null +++ b/testsuite/pyunit/dom/SimpleEntity.py @@ -0,0 +1,46 @@ +from pathlib import Path +from unittest import TestCase + +from pyGHDL.dom.Misc import Design, Library, 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 SimpleEntity(TestCase): + _root = Path(__file__).resolve().parent.parent + _filename : Path = _root / "SimpleEntity.vhdl" + + def test_Design(self): + design = Design() + + self.assertIsNotNone(design) + + # def test_Library(self): + # library = Library() + + def test_Document(self): + design = Design() + document = Document(self._filename) + design.Documents.append(document) + + self.assertTrue(len(design.Documents) == 1) + + def test_Entity(self): + design = Design() + document = Document(self._filename) + design.Documents.append(document) + + self.assertEqual(len(design.Documents[0].Entities), 1) + self.assertTrue(design.Documents[0].Entities[0].Name == "e1") + + def test_Architecture(self): + design = Design() + document = Document(self._filename) + design.Documents.append(document) + + self.assertEqual(len(design.Documents[0].Architectures), 1) + self.assertTrue(design.Documents[0].Architectures[0].Name == "behav") |