From bd4aff0f670351c0652cf24e9b04361dc0e3a01c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 18 Dec 2013 05:53:22 +0100 Subject: Add initial testsuite, using regression tests from bugs or support reported on gna.org --- testsuite/gna/bug20255/test.vhd | 16 ++++++++++++++++ testsuite/gna/bug20255/test_20255.vhd | 32 ++++++++++++++++++++++++++++++++ testsuite/gna/bug20255/testsuite.sh | 13 +++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 testsuite/gna/bug20255/test.vhd create mode 100644 testsuite/gna/bug20255/test_20255.vhd create mode 100755 testsuite/gna/bug20255/testsuite.sh (limited to 'testsuite/gna/bug20255') diff --git a/testsuite/gna/bug20255/test.vhd b/testsuite/gna/bug20255/test.vhd new file mode 100644 index 000000000..52b72ff45 --- /dev/null +++ b/testsuite/gna/bug20255/test.vhd @@ -0,0 +1,16 @@ +entity e is +end entity e; +architecture test of e is +begin + test : process is + + type frequency is range -2147483647 to 2147483647 units KHz; + MHz = 1000 KHz; + GHz = 1000 MHz; + end units; + begin + assert frequency'image(2 MHz) = "2000 khz"; -- this should work, but GHDL produces an error + wait; + end process; + +end architecture test; diff --git a/testsuite/gna/bug20255/test_20255.vhd b/testsuite/gna/bug20255/test_20255.vhd new file mode 100644 index 000000000..d647f4639 --- /dev/null +++ b/testsuite/gna/bug20255/test_20255.vhd @@ -0,0 +1,32 @@ +entity e is +end entity e; +architecture test of e is +signal s : string(1 to 9) := "2.345 Mhz"; +signal s2 : string(1 to 9) := "2345 khz "; + + type frequency is range -2147483647 to 2147483647 units KHz; + MHz = 1000 KHz; + GHz = 1000 MHz; + end units; + +signal f : frequency := 3.456 MHz; + +begin + test : process is + + + begin + assert frequency'image(2 MHz) = "2000 khz"; + assert frequency'image(f) = "3456 khz"; + + assert frequency'value("2000 khz") = 2 MHz ; + assert frequency'value("2345 khz") = 2.345 MHz ; + assert frequency'value("2 MHz") = 2000 kHz ; + + assert frequency'value("2.345 Mhz") = 2345 kHz ; + assert frequency'value(s) = 2345 kHz ; + assert frequency'value(s2) = 2345 kHz ; + wait; + end process; + +end architecture test; diff --git a/testsuite/gna/bug20255/testsuite.sh b/testsuite/gna/bug20255/testsuite.sh new file mode 100755 index 000000000..51d7305a1 --- /dev/null +++ b/testsuite/gna/bug20255/testsuite.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze test.vhd +elab_simulate e + +analyze test_20255.vhd +elab_simulate e + +clean + +echo "Test successful" -- cgit v1.2.3