summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-28 15:18:15 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-28 15:18:15 -0400
commit670a9729fdd425c1b920f8af1c582dfeceb9e721 (patch)
tree2f86fc482e2f65718774add9477cf0c3b7ba8808 /tests
parent45762bced35335cdb4d51f65cef6d405b88b252a (diff)
Change run script to test all
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile2
-rwxr-xr-xtests/run.sh16
-rw-r--r--tests/test_method_3.tnsl3
3 files changed, 13 insertions, 8 deletions
diff --git a/tests/Makefile b/tests/Makefile
index d1a2c46..0b25a68 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -7,8 +7,8 @@ src_files := $(wildcard *.tnsl)
obj_files := $(src_files:.tnsl=.o)
out_files := $(src_files:.tnsl=.out)
+.PHONY: all outdir clean
all: outdir $(out_files)
-.PHONY: all test
%.asm: %.tnsl
../ctc $< $(obj_dir)/$@
diff --git a/tests/run.sh b/tests/run.sh
index 136dac1..0fbb196 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -1,9 +1,13 @@
#!/bin/bash
-mkdir -p ./out/artifact
-filename=$1
-filename="${filename%.*}"
-../ctc $1 out/artifact/$filename.asm
-nasm -f elf64 -o ./out/artifact/$filename.o ./out/artifact/$filename.asm
-gcc -o ./out/$filename ./out/artifact/$filename.o
+make
+
+for i in out/*.out; do
+ ./$i
+ if [[ $? -ne 69 ]]; then
+ echo "[FAILED] $i"
+ else
+ echo "[ OK ] $i"
+ fi
+done
diff --git a/tests/test_method_3.tnsl b/tests/test_method_3.tnsl
index 46dec79..c1e4904 100644
--- a/tests/test_method_3.tnsl
+++ b/tests/test_method_3.tnsl
@@ -14,6 +14,7 @@ struct Mock {
Mock a
a.i = 69
a.j = 0
- return a.mul()
+ a.mul()
+ return a.i
;/