aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit/dom/Literals.py
diff options
context:
space:
mode:
authorUnai Martinez-Corral <38422348+umarcor@users.noreply.github.com>2021-06-23 16:07:10 +0100
committerGitHub <noreply@github.com>2021-06-23 16:07:10 +0100
commitc6283d9a9b40c3e9afeba912fcb13aa9d56b9c52 (patch)
treee1706cb19a2439e3d94657e54c688a36c703f048 /testsuite/pyunit/dom/Literals.py
parent983236ac3dfd0c455a0ac910a9a468ea2c81e5d9 (diff)
parent240b4fdd90a9f3ca04e8e168bffdc92bea2ca3f3 (diff)
downloadghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.tar.gz
ghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.tar.bz2
ghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.zip
DOM: Functions and types (#1804)
Diffstat (limited to 'testsuite/pyunit/dom/Literals.py')
-rw-r--r--testsuite/pyunit/dom/Literals.py46
1 files changed, 41 insertions, 5 deletions
diff --git a/testsuite/pyunit/dom/Literals.py b/testsuite/pyunit/dom/Literals.py
index c542ebfe5..ebd702f5e 100644
--- a/testsuite/pyunit/dom/Literals.py
+++ b/testsuite/pyunit/dom/Literals.py
@@ -1,8 +1,40 @@
-from pathlib import Path
+# =============================================================================
+# ____ _ _ ____ _ _
+# _ __ _ _ / ___| | | | _ \| | __| | ___ _ __ ___
+# | '_ \| | | | | _| |_| | | | | | / _` |/ _ \| '_ ` _ \
+# | |_) | |_| | |_| | _ | |_| | |___ | (_| | (_) | | | | | |
+# | .__/ \__, |\____|_| |_|____/|_____(_)__,_|\___/|_| |_| |_|
+# |_| |___/
+# =============================================================================
+# Authors:
+# Patrick Lehmann
+#
+# Testsuite: Check libghdl IIR translation to DOM for literals.
+#
+# License:
+# ============================================================================
+# Copyright (C) 2019-2021 Tristan Gingold
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# ============================================================================
+from pathlib import Path
from textwrap import dedent
from unittest import TestCase
-from pyGHDL.dom.NonStandard import Design, Document
+from pyGHDL.dom.NonStandard import Design, Document
from pyGHDL.dom.Object import Constant
from pyGHDL.dom.Literal import IntegerLiteral
@@ -17,16 +49,20 @@ class Literals(TestCase):
_root = Path(__file__).resolve().parent.parent
def test_IntegerLiteral(self):
- self._filename: Path = self._root / "{className}.vhdl".format(className=self.__class__.__name__)
+ self._filename: Path = self._root / "{className}.vhdl".format(
+ className=self.__class__.__name__
+ )
- sourceCode = dedent("""\
+ sourceCode = dedent(
+ """\
package package_1 is
constant c0 : integer := 0;
constant c1 : integer := 1;
constant c2 : integer := 1024;
constant c3 : integer := 1048576;
end package;
- """)
+ """
+ )
expected = (0, 1, 1024, 1048576)
with self._filename.open(mode="w", encoding="utf-8") as file: