aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-10-17 07:45:38 +0200
committerTristan Gingold <tgingold@free.fr>2022-10-17 07:45:38 +0200
commit8259ae6a5f27ae773c44a4783c4c6d9b2ac8f252 (patch)
treeb3e125461fd6578e1592ef9968155b7ec981138b /testsuite
parente261c627fec2739866da88156f4491e2eaa10ec5 (diff)
downloadghdl-8259ae6a5f27ae773c44a4783c4c6d9b2ac8f252.tar.gz
ghdl-8259ae6a5f27ae773c44a4783c4c6d9b2ac8f252.tar.bz2
ghdl-8259ae6a5f27ae773c44a4783c4c6d9b2ac8f252.zip
testsuite/gna: add a test for #2215
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue2215/e.ref10
-rw-r--r--testsuite/gna/issue2215/e.vhdl33
-rwxr-xr-xtestsuite/gna/issue2215/testsuite.sh12
3 files changed, 55 insertions, 0 deletions
diff --git a/testsuite/gna/issue2215/e.ref b/testsuite/gna/issue2215/e.ref
new file mode 100644
index 000000000..0eb5f00e2
--- /dev/null
+++ b/testsuite/gna/issue2215/e.ref
@@ -0,0 +1,10 @@
+elaborate and simulate e
+e.vhdl:15:9:@0ms:(report note): exp: -1.7976931348623157e308, act: -1.7976931348623157e308
+e.vhdl:16:9:@0ms:(report note): exp: ???, act: -inf
+e.vhdl:19:9:@0ms:(report note): exp: 2.0, act: 2.0
+e.vhdl:20:9:@0ms:(report note): exp: 1.002e3, act: 1.002e3
+e.vhdl:23:9:@0ms:(report note): exp: 2.0, act: 2.0
+e.vhdl:24:9:@0ms:(report note): exp: 1.002e3, act: 1.002e3
+e.vhdl:27:9:@0ms:(report note): exp: 2.0, act: 2.0
+e.vhdl:28:9:@0ms:(report note): exp: 1.002e3, act: 1.002e3
+simulation finished @0ms
diff --git a/testsuite/gna/issue2215/e.vhdl b/testsuite/gna/issue2215/e.vhdl
new file mode 100644
index 000000000..beea5b82d
--- /dev/null
+++ b/testsuite/gna/issue2215/e.vhdl
@@ -0,0 +1,33 @@
+entity e is end;
+
+architecture a of e is
+begin
+ process
+ variable v : real;
+
+ subtype t is real range 2.0 to 2.0;
+ variable v1 : t;
+
+ variable v2 : t := 2.0;
+
+ constant c1 : t := 2.0;
+ begin
+ report "exp: -1.7976931348623157e308, act: " & real'image(v);
+ report "exp: ???, act: " & real'image(v * 1000.0);
+ assert v = real'left severity failure; -- Should not trigger. Does not trigger
+
+ report "exp: 2.0, act: " & real'image(v1);
+ report "exp: 1.002e3, act: " & real'image(v1 + 1000.0);
+ assert v1 = t'left severity failure; -- Should not trigger. Does not trigger
+
+ report "exp: 2.0, act: " & real'image(v2);
+ report "exp: 1.002e3, act: " & real'image(v2 + 1000.0);
+ assert v2 = t'left severity failure; -- Should not trigger. Does not trigger
+
+ report "exp: 2.0, act: " & real'image(c1);
+ report "exp: 1.002e3, act: " & real'image(c1 + 1000.0);
+ assert c1 = t'left severity failure; -- Should not trigger. Does not trigger
+
+ std.env.finish;
+ end process;
+end;
diff --git a/testsuite/gna/issue2215/testsuite.sh b/testsuite/gna/issue2215/testsuite.sh
new file mode 100755
index 000000000..264ba0cb8
--- /dev/null
+++ b/testsuite/gna/issue2215/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze e.vhdl
+elab_simulate e > e.out
+diff_nocr e.ref e.out
+
+clean
+
+echo "Test successful"