aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-09-15 01:49:03 +0200
committerTristan Gingold <tgingold@free.fr>2016-09-15 01:49:03 +0200
commit0557b7d15c6f44720e7122bf480e67f1e168f13f (patch)
treee2410f04ffe72684839f21d92eaa9188b04acbf1 /testsuite/gna
parentd29da5f1dbc2aea1ff1ccab5e7d5e07cdcb825ce (diff)
downloadghdl-0557b7d15c6f44720e7122bf480e67f1e168f13f.tar.gz
ghdl-0557b7d15c6f44720e7122bf480e67f1e168f13f.tar.bz2
ghdl-0557b7d15c6f44720e7122bf480e67f1e168f13f.zip
Add testcase for generic-mapped package
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/bug057/tb.vhdl21
-rw-r--r--testsuite/gna/bug057/tb2.vhdl20
-rwxr-xr-xtestsuite/gna/bug057/testsuite.sh15
3 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/gna/bug057/tb.vhdl b/testsuite/gna/bug057/tb.vhdl
new file mode 100644
index 000000000..cc4b8f9f3
--- /dev/null
+++ b/testsuite/gna/bug057/tb.vhdl
@@ -0,0 +1,21 @@
+package pkg1 is
+ generic (c : natural);
+ generic map (c => 5);
+
+ function f return natural;
+end pkg1;
+
+package body pkg1 is
+ function f return natural is
+ begin
+ return c;
+ end f;
+end pkg1;
+
+entity tb is
+end tb;
+
+architecture behav of tb is
+begin
+ assert work.pkg1.f = 5;
+end behav;
diff --git a/testsuite/gna/bug057/tb2.vhdl b/testsuite/gna/bug057/tb2.vhdl
new file mode 100644
index 000000000..98f7bc5c1
--- /dev/null
+++ b/testsuite/gna/bug057/tb2.vhdl
@@ -0,0 +1,20 @@
+entity tb2 is
+end tb2;
+
+architecture behav of tb2 is
+ package pkg1 is
+ generic (c : natural);
+ generic map (c => 5);
+
+ function f return natural;
+ end pkg1;
+
+ package body pkg1 is
+ function f return natural is
+ begin
+ return c;
+ end f;
+ end pkg1;
+begin
+ assert pkg1.f = 5 severity failure;
+end behav;
diff --git a/testsuite/gna/bug057/testsuite.sh b/testsuite/gna/bug057/testsuite.sh
new file mode 100755
index 000000000..737932da6
--- /dev/null
+++ b/testsuite/gna/bug057/testsuite.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+GHDL_STD_FLAGS=--std=08
+
+analyze tb.vhdl
+elab_simulate tb
+
+analyze tb2.vhdl
+elab_simulate tb2
+
+clean
+
+echo "Test successful"