aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-12 06:47:27 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-12 06:47:27 +0100
commit82548be462091370f1fbd664c590bebe8f6f7096 (patch)
treebc288842c9c8d1f719a0172b0e30b04dd6e0ff15 /testsuite/gna
parentf17db2f3f39d1a7e8104139eead99b7f4c5b6e0d (diff)
downloadghdl-82548be462091370f1fbd664c590bebe8f6f7096.tar.gz
ghdl-82548be462091370f1fbd664c590bebe8f6f7096.tar.bz2
ghdl-82548be462091370f1fbd664c590bebe8f6f7096.zip
Add more test cases for #646
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue646/repro2.vhdl20
-rw-r--r--testsuite/gna/issue646/repro3.vhdl25
-rw-r--r--testsuite/gna/issue646/repro4.vhdl33
-rwxr-xr-xtestsuite/gna/issue646/testsuite.sh10
4 files changed, 88 insertions, 0 deletions
diff --git a/testsuite/gna/issue646/repro2.vhdl b/testsuite/gna/issue646/repro2.vhdl
new file mode 100644
index 000000000..80d59ace7
--- /dev/null
+++ b/testsuite/gna/issue646/repro2.vhdl
@@ -0,0 +1,20 @@
+entity repro2 is
+end entity;
+
+architecture tb of repro2 is
+
+ type tb_cfg_t is record
+ value : string;
+ end record tb_cfg_t;
+
+ function get_msg return string is
+ begin
+ return "goodbye";
+ end get_msg;
+
+ constant tb_cfg: tb_cfg_t := ( value => get_msg );
+begin
+ assert tb_cfg.value > "a";
+end tb;
+
+
diff --git a/testsuite/gna/issue646/repro3.vhdl b/testsuite/gna/issue646/repro3.vhdl
new file mode 100644
index 000000000..7d02c25f4
--- /dev/null
+++ b/testsuite/gna/issue646/repro3.vhdl
@@ -0,0 +1,25 @@
+entity repro3 is
+end entity;
+
+architecture tb of repro3 is
+
+ type tb_cfg_t is record
+ value : string;
+ end record tb_cfg_t;
+
+ function get_msg return string is
+ begin
+ return "goodbye";
+ end get_msg;
+
+ function init return tb_cfg_t is
+ begin
+ return (value => get_msg);
+ end init;
+
+ constant tb_cfg: tb_cfg_t := init;
+begin
+ assert tb_cfg.value > "a";
+end tb;
+
+
diff --git a/testsuite/gna/issue646/repro4.vhdl b/testsuite/gna/issue646/repro4.vhdl
new file mode 100644
index 000000000..8bd890df8
--- /dev/null
+++ b/testsuite/gna/issue646/repro4.vhdl
@@ -0,0 +1,33 @@
+entity repro4 is
+end entity;
+
+architecture tb of repro4 is
+
+ type channel is record
+ data : bit_vector;
+ ack : bit;
+ end record;
+
+ type my_bus is record
+ rd : channel;
+ wr : channel;
+ end record;
+
+ function init_channel (width : natural) return channel is
+ begin
+ return (data => (width - 1 downto 0 => '0'),
+ ack => '0');
+ end init_channel;
+
+ function init_bus (width : natural) return my_bus is
+ begin
+ return (rd => init_channel (width),
+ wr => init_channel (width));
+ end init_bus;
+
+ constant b : my_bus := init_bus (12);
+begin
+ assert b.rd.data(2) = '0';
+end tb;
+
+
diff --git a/testsuite/gna/issue646/testsuite.sh b/testsuite/gna/issue646/testsuite.sh
index ca326e2f6..0c6fa9fa0 100755
--- a/testsuite/gna/issue646/testsuite.sh
+++ b/testsuite/gna/issue646/testsuite.sh
@@ -7,6 +7,16 @@ export GHDL_STD_FLAGS=--std=08
analyze repro.vhdl
elab_simulate repro
+# TODO: init value.
+#analyze repro2.vhdl
+#elab_simulate repro2
+
+analyze repro3.vhdl
+elab_simulate repro3
+
+analyze repro4.vhdl
+elab_simulate repro4
+
clean
echo "Test successful"