diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-12-05 03:22:50 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-12-05 03:25:22 +0100 |
commit | 8c6e74a5dea5324e72b12482b35e92d278c9bffa (patch) | |
tree | 48474ae4808c07334b8a2e8959ce4701374128d9 /testsuite/gna/bug058 | |
parent | 0f94031b6843794dfdd7e1c0a1b72235908cecd9 (diff) | |
download | ghdl-8c6e74a5dea5324e72b12482b35e92d278c9bffa.tar.gz ghdl-8c6e74a5dea5324e72b12482b35e92d278c9bffa.tar.bz2 ghdl-8c6e74a5dea5324e72b12482b35e92d278c9bffa.zip |
Add testcase for interface function.
Diffstat (limited to 'testsuite/gna/bug058')
-rw-r--r-- | testsuite/gna/bug058/tb.vhdl | 22 | ||||
-rw-r--r-- | testsuite/gna/bug058/tb1.vhdl | 21 | ||||
-rw-r--r-- | testsuite/gna/bug058/tb2.vhdl | 20 | ||||
-rwxr-xr-x | testsuite/gna/bug058/testsuite.sh | 15 |
4 files changed, 78 insertions, 0 deletions
diff --git a/testsuite/gna/bug058/tb.vhdl b/testsuite/gna/bug058/tb.vhdl new file mode 100644 index 000000000..779a5d6f6 --- /dev/null +++ b/testsuite/gna/bug058/tb.vhdl @@ -0,0 +1,22 @@ +package pkg1 is + generic (type t; c : natural); + generic map (t => natural, c => 5); + + function f return natural; +end pkg1; + +package body pkg1 is + function f return natural is + variable v : t; + 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/bug058/tb1.vhdl b/testsuite/gna/bug058/tb1.vhdl new file mode 100644 index 000000000..1e183bec2 --- /dev/null +++ b/testsuite/gna/bug058/tb1.vhdl @@ -0,0 +1,21 @@ +package pkg1 is + generic (type t; c : t); + generic map (t => natural, c => 5); + + function f return t; +end pkg1; + +package body pkg1 is + function f return t 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/bug058/tb2.vhdl b/testsuite/gna/bug058/tb2.vhdl new file mode 100644 index 000000000..98f7bc5c1 --- /dev/null +++ b/testsuite/gna/bug058/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/bug058/testsuite.sh b/testsuite/gna/bug058/testsuite.sh new file mode 100755 index 000000000..737932da6 --- /dev/null +++ b/testsuite/gna/bug058/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" |