| 123456789101112131415161718192021222324252627282930313233343536373839 |
- #!/bin/sh
- # Regression for M2comp step 2 (Coco/R + SymTab semantic analysis).
- # Usage: ./run_tests.sh (from the m2comp directory)
- pass=0; fail=0
- expect_ok() {
- if ./M2comp "$1" 2>&1 | grep -q "Parsed correctly"; then
- pass=$((pass+1)); echo "PASS(ok): $1"
- else
- fail=$((fail+1)); echo "FAIL(ok, rejected): $1"
- fi
- }
- expect_fail() {
- if ./M2comp "$1" 2>&1 | grep -q "Incorrect source"; then
- pass=$((pass+1)); echo "PASS(fail): $1"
- else
- fail=$((fail+1)); echo "FAIL(fail, accepted): $1"
- fi
- }
- expect_ok tests/ok_minimal.mod
- expect_ok tests/ok_proc.mod
- expect_ok tests/showcase.mod
- expect_fail tests/bad_mismatch.mod
- expect_fail tests/t_dup.mod
- expect_fail tests/t_undecl.mod
- expect_fail tests/t_assign.mod
- expect_fail tests/t_arith.mod
- expect_fail tests/t_bool.mod
- expect_fail tests/t_rel.mod
- expect_fail tests/t_cond.mod
- expect_fail tests/t_field.mod
- expect_fail tests/t_index.mod
- expect_fail tests/t_ptr.mod
- expect_fail tests/t_for.mod
- expect_fail tests/t_call.mod
- expect_fail tests/t_call2.mod
- expect_fail tests/t_return.mod
- expect_fail tests/t_exit.mod
- echo "--- $pass passed, $fail failed ---"
- [ "$fail" -eq 0 ]
|