summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:15:05 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:15:05 +0000
commita524ba47371503e0a42d395d015dcd83c15c0199 (patch)
tree35d4d7e327002f66776aeaa3b00b3e44792bae19 /tests
parent55247a3f12a9eee7ba3fd7ca6d8fcea7a82c20f3 (diff)
Added Makefile and script for tests.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run_tests.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
new file mode 100755
index 0000000..0578681
--- /dev/null
+++ b/tests/run_tests.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# Configuration
+ZC="./zc"
+TEST_DIR="tests"
+PASSED=0
+FAILED=0
+FAILED_TESTS=""
+
+echo "** Running Zen C test suite **"
+
+if [ ! -f "$ZC" ]; then
+ echo "Error: zc binary not found. Please build it first."
+ exit 1
+fi
+
+for test_file in "$TEST_DIR"/*.zc; do
+ [ -e "$test_file" ] || continue
+
+ echo -n "Testing $(basename "$test_file")... "
+
+ output=$($ZC run "$test_file" "$@" 2>&1)
+ exit_code=$?
+
+ if [ $exit_code -eq 0 ]; then
+ echo "PASS"
+ ((PASSED++))
+ else
+ echo "FAIL"
+ ((FAILED++))
+ FAILED_TESTS="$FAILED_TESTS\n- $(basename "$test_file")"
+ fi
+done
+
+echo "----------------------------------------"
+echo "Summary:"
+echo "-> Passed: $PASSED"
+echo "-> Failed: $FAILED"
+echo "----------------------------------------"
+
+if [ $FAILED -ne 0 ]; then
+ echo -e "Failed tests:$FAILED_TESTS"
+ exit 1
+else
+ echo "All tests passed!"
+ exit 0
+fi