summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-28 15:08:07 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-28 15:08:07 -0400
commit45762bced35335cdb4d51f65cef6d405b88b252a (patch)
treecd7a130323e4d029ed0fab8eec890df10a078d08 /tests
parent47e23274dc0fb78389e396fb41391ea089bcea66 (diff)
Makefile for tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile28
-rw-r--r--tests/test_struct_2.tnsl13
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..d1a2c46
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,28 @@
+empty :=
+
+out_dir := out
+obj_dir := $(out_dir)/artifacts
+
+src_files := $(wildcard *.tnsl)
+obj_files := $(src_files:.tnsl=.o)
+out_files := $(src_files:.tnsl=.out)
+
+all: outdir $(out_files)
+.PHONY: all test
+
+%.asm: %.tnsl
+ ../ctc $< $(obj_dir)/$@
+
+%.o: %.asm
+ nasm -f elf64 -o $(obj_dir)/$@ $(obj_dir)/$<
+
+%.out: %.o
+ gcc -o $(out_dir)/$@ $(obj_dir)/$<
+
+outdir:
+ mkdir -p $(out_dir)
+ mkdir -p $(obj_dir)
+
+clean:
+ rm -rf out/*
+
diff --git a/tests/test_struct_2.tnsl b/tests/test_struct_2.tnsl
new file mode 100644
index 0000000..2577959
--- /dev/null
+++ b/tests/test_struct_2.tnsl
@@ -0,0 +1,13 @@
+struct Rec {
+ ~Rec r,
+ int i
+}
+
+/; main [int]
+
+ Rec a, b
+ a.i = 1
+ a.r = ~b
+ a.r`.i = 69
+ return b.i
+;/