aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-06 09:36:10 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-06 09:36:10 +0200
commitce416ec62d20f1a592835efe5cbe49856d7085a2 (patch)
treeb008fe10776a7831d24f9e29b63781ccae876500 /testsuite/gna
parent6facf7626446acce5693b257fe7643d7b565118d (diff)
downloadghdl-ce416ec62d20f1a592835efe5cbe49856d7085a2.tar.gz
ghdl-ce416ec62d20f1a592835efe5cbe49856d7085a2.tar.bz2
ghdl-ce416ec62d20f1a592835efe5cbe49856d7085a2.zip
Add testcase for #877
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue877/aa.vhdl4
-rw-r--r--testsuite/gna/issue877/aa2.vhdl4
-rw-r--r--testsuite/gna/issue877/tb.vhdl9
-rw-r--r--testsuite/gna/issue877/tb2.vhdl14
-rwxr-xr-xtestsuite/gna/issue877/testsuite.sh12
5 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/gna/issue877/aa.vhdl b/testsuite/gna/issue877/aa.vhdl
new file mode 100644
index 000000000..daa4f0876
--- /dev/null
+++ b/testsuite/gna/issue877/aa.vhdl
@@ -0,0 +1,4 @@
+package aa is
+constant a : integer_vector(0 to 1) := (0, 1);
+constant b : integer_vector(0 to 0) := a(integer range 0 to 0);
+end package aa;
diff --git a/testsuite/gna/issue877/aa2.vhdl b/testsuite/gna/issue877/aa2.vhdl
new file mode 100644
index 000000000..dd0b7086f
--- /dev/null
+++ b/testsuite/gna/issue877/aa2.vhdl
@@ -0,0 +1,4 @@
+package aa2 is
+constant a : bit_vector(0 to 1) := ('0', '1');
+constant b : bit_vector(0 to 0) := a(integer range 0 to 0);
+end package aa2;
diff --git a/testsuite/gna/issue877/tb.vhdl b/testsuite/gna/issue877/tb.vhdl
new file mode 100644
index 000000000..e88ab827f
--- /dev/null
+++ b/testsuite/gna/issue877/tb.vhdl
@@ -0,0 +1,9 @@
+entity tb is
+end tb;
+
+architecture behav of tb is
+ constant msg : string := "hello world";
+begin
+ assert msg (positive range 1 to 5) = "hello" severity failure;
+ assert msg (positive range 7 to 11) = "world";
+end behav;
diff --git a/testsuite/gna/issue877/tb2.vhdl b/testsuite/gna/issue877/tb2.vhdl
new file mode 100644
index 000000000..e590992b0
--- /dev/null
+++ b/testsuite/gna/issue877/tb2.vhdl
@@ -0,0 +1,14 @@
+entity tb is
+end tb;
+
+architecture behav of tb is
+ constant msg : string := "hello world";
+ procedure chk (b : natural)
+ is
+ subtype my_rng is natural range 1 to b;
+ begin
+ assert msg (chk.my_rng) = "hello";
+ end chk;
+begin
+ chk(5);
+end behav;
diff --git a/testsuite/gna/issue877/testsuite.sh b/testsuite/gna/issue877/testsuite.sh
new file mode 100755
index 000000000..7a4443d03
--- /dev/null
+++ b/testsuite/gna/issue877/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze aa2.vhdl
+
+analyze tb.vhdl
+elab_simulate tb
+
+clean
+
+echo "Test successful"