aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-07-26 18:50:33 +0200
committerTristan Gingold <tgingold@free.fr>2019-07-26 18:50:33 +0200
commitfc5ed4cb9c73414eeb821aa5183954cee1866251 (patch)
treeef8e1942d6cb3f61ce3e62f81a711b2ab267f9e7 /testsuite
parent401341a2c5f2533ff68aae9dd4e65bb297c36679 (diff)
downloadghdl-fc5ed4cb9c73414eeb821aa5183954cee1866251.tar.gz
ghdl-fc5ed4cb9c73414eeb821aa5183954cee1866251.tar.bz2
ghdl-fc5ed4cb9c73414eeb821aa5183954cee1866251.zip
vhdl: add tests for concat.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/bug0105/econcat1.vhdl20
-rw-r--r--testsuite/gna/bug0105/econcat1_87.vhdl20
-rw-r--r--testsuite/gna/bug0105/econcat2.vhdl17
-rw-r--r--testsuite/gna/bug0105/econcat2_87.vhdl20
-rwxr-xr-xtestsuite/gna/bug0105/testsuite.sh22
5 files changed, 99 insertions, 0 deletions
diff --git a/testsuite/gna/bug0105/econcat1.vhdl b/testsuite/gna/bug0105/econcat1.vhdl
new file mode 100644
index 000000000..2cc80027d
--- /dev/null
+++ b/testsuite/gna/bug0105/econcat1.vhdl
@@ -0,0 +1,20 @@
+entity econcat1 is
+end econcat1;
+
+architecture behav of econcat1 is
+ constant c1 : string (1 to 5) := "hello";
+ constant c2 : string (6 downto 1) := " world";
+ constant r : string := c1 & c2;
+begin
+ process
+ begin
+ case True is
+ when c1 & c2 = "hello world" => null;
+ when false => null;
+ end case;
+
+ assert r'left = 1 severity failure;
+ assert r'right = 11 severity failure;
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/bug0105/econcat1_87.vhdl b/testsuite/gna/bug0105/econcat1_87.vhdl
new file mode 100644
index 000000000..71daeac4b
--- /dev/null
+++ b/testsuite/gna/bug0105/econcat1_87.vhdl
@@ -0,0 +1,20 @@
+entity econcat1_87 is
+end econcat1_87;
+
+architecture behav of econcat1_87 is
+ constant c1 : string (21 downto 17) := "hello";
+ constant c2 : string (6 downto 1) := " world";
+ constant r : string := c1 & c2;
+begin
+ process
+ begin
+ case True is
+ when c1 & c2 = "hello world" => null;
+ when false => null;
+ end case;
+
+ assert r'left = 21 severity failure;
+ assert r'right = 11 severity failure;
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/bug0105/econcat2.vhdl b/testsuite/gna/bug0105/econcat2.vhdl
new file mode 100644
index 000000000..8c343d2c4
--- /dev/null
+++ b/testsuite/gna/bug0105/econcat2.vhdl
@@ -0,0 +1,17 @@
+entity econcat2 is
+end econcat2;
+
+architecture behav of econcat2 is
+ constant c1 : string (1 to 5) := "hello";
+ constant c2 : string (6 downto 1) := " world";
+ constant r : string := c1 & c2;
+begin
+ process
+ begin
+ case True is
+ when "&" (c1, c2) = "hello world" => null;
+ when false => null;
+ end case;
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/bug0105/econcat2_87.vhdl b/testsuite/gna/bug0105/econcat2_87.vhdl
new file mode 100644
index 000000000..7b297f983
--- /dev/null
+++ b/testsuite/gna/bug0105/econcat2_87.vhdl
@@ -0,0 +1,20 @@
+entity econcat2_87 is
+end econcat2_87;
+
+architecture behav of econcat2_87 is
+ constant c1 : string (21 downto 17) := "hello";
+ constant c2 : string (6 downto 1) := " world";
+ constant r : string := "" & c1 & "" & c2;
+begin
+ process
+ begin
+ case True is
+ when c1 & c2 = "hello world" => null;
+ when false => null;
+ end case;
+
+ assert r'left = 21 severity failure;
+ assert r'right = 11 severity failure;
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/bug0105/testsuite.sh b/testsuite/gna/bug0105/testsuite.sh
new file mode 100755
index 000000000..a9a64b8f6
--- /dev/null
+++ b/testsuite/gna/bug0105/testsuite.sh
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze econcat1.vhdl
+elab_simulate econcat1
+
+analyze econcat2.vhdl
+elab_simulate econcat2
+
+clean
+
+GHDL_STD_FLAGS="--std=87"
+
+analyze econcat1_87.vhdl
+elab_simulate econcat1_87
+
+analyze econcat2_87.vhdl
+elab_simulate econcat2_87
+
+clean
+echo "Test successful"