diff --git a/test/error/enum_conflict.sv b/test/error/enum_conflict.sv new file mode 100644 index 0000000..1023842 --- /dev/null +++ b/test/error/enum_conflict.sv @@ -0,0 +1,8 @@ +module top; + typedef enum { + A = 0, + B, // implicitly 1 + C = 1 + } Enum; + Enum e; +endmodule diff --git a/test/error/highz0_highz1.sv b/test/error/highz0_highz1.sv new file mode 100644 index 0000000..385453b --- /dev/null +++ b/test/error/highz0_highz1.sv @@ -0,0 +1,3 @@ +module top; + wire (highz0, highz1) x; +endmodule diff --git a/test/error/run.sh b/test/error/run.sh new file mode 100755 index 0000000..e9866f1 --- /dev/null +++ b/test/error/run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +addTest() { + test=$1 + eval "test_$test() { \ + $SV2V $test.sv 2> /dev/null > /dev/null; \ + assertFalse \"conversion should have failed\" \$?; \ + }" + suite_addTest test_$test +} + +source ../lib/discover.sh + +. shunit2 diff --git a/test/error/unmatched_endif.sv b/test/error/unmatched_endif.sv new file mode 100644 index 0000000..1d53b92 --- /dev/null +++ b/test/error/unmatched_endif.sv @@ -0,0 +1 @@ +`endif diff --git a/test/lib/discover.sh b/test/lib/discover.sh new file mode 100644 index 0000000..ce65788 --- /dev/null +++ b/test/lib/discover.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +tests=(`basename -s .sv *.sv`) + +if [ $1 ]; then + tests=(`basename -s .sv "$@"`) + shift ${#tests[@]} +fi + +suite() { + for test in "${tests[@]}"; do + if [ ! -f $test.sv ]; then + echo "Could not find $test.sv" + exit 1 + fi + addTest $test + done +} diff --git a/test/lib/runner.sh b/test/lib/runner.sh index b235ca3..a899d31 100644 --- a/test/lib/runner.sh +++ b/test/lib/runner.sh @@ -2,31 +2,13 @@ SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"` -tests=(`ls *.sv | sed -e "s_\.sv\\\$__"`) - -if [ $1 ]; then - tests=("$@") - shift ${#tests[@]} - for test in $tests; do - if [ ! -f $test.sv ]; then - echo "Could not find $test.sv" - exit 1 - fi - done -fi - addTest() { test=$1 eval "test_$test() { runTest \"$test\"; }" suite_addTest test_$test } -suite() { - for test in "${tests[@]}"; do - addTest $test - done -} - source $SCRIPT_DIR/functions.sh +source $SCRIPT_DIR/discover.sh . shunit2 diff --git a/test/resolve/run.sh b/test/resolve/run.sh index e5ba118..bb30b78 100755 --- a/test/resolve/run.sh +++ b/test/resolve/run.sh @@ -6,10 +6,6 @@ test_main() { simulateAndCompare "reference.v" "$cv" "$SCRIPT_DIR/empty.v" } -suite() { - suite_addTest "test_main" -} - source ../lib/functions.sh . shunit2