Add x64 emitter tests

This commit is contained in:
Krzosa Karol
2026-05-23 08:35:43 +02:00
parent a0adc03bcb
commit 0058355611
4 changed files with 25 additions and 54 deletions

View File

@@ -1,20 +1,4 @@
# set -euo pipefail
assert_eq() {
expected="$1"
actual="$2"
if [ "$expected" != "$actual" ]; then
echo "assert failed: expected '$expected', got '$actual'"
exit 1
fi
}
verify_expr() {
./main "$1"
clang out.s -o test
./test
assert_eq $? $2
}
set -euo pipefail
if [[ ! -e build ]]; then
mkdir build
@@ -23,10 +7,4 @@ cd build
clang -o meta $(realpath ../meta.c) -g -Wall -Wextra -Wshadow -fdiagnostics-absolute-paths
./meta > ../meta_gen.c
clang -o main $(realpath ../main.c) -g -Wall -Wextra -Wshadow -fdiagnostics-absolute-paths
./main
verify_expr "2+1-1" 2
verify_expr "(2+1-1)*3" 6
echo done