From 377822b957c442b2ff0882b8325033487037be2b Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 21 Jun 2024 14:18:54 +0100 Subject: þ -> th MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- Makefile | 8 ++++---- run_tests.sh | 8 ++++---- tests/compile_error.bth | 1 + "tests/compile_error.b\303\276" | 1 - tests/fizzbuzz.bth | 10 ++++++++++ "tests/fizzbuzz.b\303\276" | 10 ---------- tests/four.bth | 1 + "tests/four.b\303\276" | 1 - tests/vars.bth | 9 +++++++++ "tests/vars.b\303\276" | 9 --------- 11 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 tests/compile_error.bth delete mode 100644 "tests/compile_error.b\303\276" create mode 100644 tests/fizzbuzz.bth delete mode 100644 "tests/fizzbuzz.b\303\276" create mode 100644 tests/four.bth delete mode 100644 "tests/four.b\303\276" create mode 100644 tests/vars.bth delete mode 100644 "tests/vars.b\303\276" diff --git a/.gitignore b/.gitignore index 17743a8..58dd503 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ prs.c prs.h -bþ +bth vm gmon.out diff --git a/Makefile b/Makefile index 917c481..907afb5 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,16 @@ CS=ast.c com.c dis.c ht.c mem.c prs.c read.c state.c val.c vm.c HS=ast.h dis.h ht.h mem.h prs.h read.h state.h val.h vm.h CFLAGS=$(EXTRA_CFLAGS) -O3 -lm -Wall -Wpedantic -Werror=implicit-function-declaration -bþ: $(CS) $(HS) Makefile - $(CC) $(CFLAGS) -o bþ $(CS) +bth: $(CS) $(HS) Makefile + $(CC) $(CFLAGS) -o bth $(CS) prs.c: g.peg packcc -o prs g.peg -test: bþ +test: bth ./run_tests.sh clean: - rm bþ prs.c prs.h + rm bth prs.c prs.h .PHONY: clean test diff --git a/run_tests.sh b/run_tests.sh index 3c561a7..ffa1a22 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -3,14 +3,14 @@ pass=0 fail=0 -for testfile in tests/*.bþ; do - outfile=${testfile%.bþ}.out - output="$(./bþ <$testfile 2>&1)" +for testfile in tests/*.bth; do + outfile=${testfile%.bth}.out + output="$(./bth <$testfile 2>&1)" run_res=$? echo "$output" | diff $outfile - >/dev/null diff_res=$? testname=${testfile#tests/} - testname=${testname%.bþ} + testname=${testname%.bth} case $diff_res in 0) printf '\033[32m\033[1mPASS\033[0m %s\n' "$testname" pass=$((pass + 1)) ;; diff --git a/tests/compile_error.bth b/tests/compile_error.bth new file mode 100644 index 0000000..b151c2f --- /dev/null +++ b/tests/compile_error.bth @@ -0,0 +1 @@ +(while) diff --git "a/tests/compile_error.b\303\276" "b/tests/compile_error.b\303\276" deleted file mode 100644 index b151c2f..0000000 --- "a/tests/compile_error.b\303\276" +++ /dev/null @@ -1 +0,0 @@ -(while) diff --git a/tests/fizzbuzz.bth b/tests/fizzbuzz.bth new file mode 100644 index 0000000..e70c2c1 --- /dev/null +++ b/tests/fizzbuzz.bth @@ -0,0 +1,10 @@ +(do + (set n 1) + (while (< n 30) + (print + (if (= 0 (% n 5)) + (if (= 0 (% n 3)) "fizzbuzz" "buzz") + (if (= 0 (% n 3)) "fizz" n))) + (set n (+ n 1)))) + + diff --git "a/tests/fizzbuzz.b\303\276" "b/tests/fizzbuzz.b\303\276" deleted file mode 100644 index e70c2c1..0000000 --- "a/tests/fizzbuzz.b\303\276" +++ /dev/null @@ -1,10 +0,0 @@ -(do - (set n 1) - (while (< n 30) - (print - (if (= 0 (% n 5)) - (if (= 0 (% n 3)) "fizzbuzz" "buzz") - (if (= 0 (% n 3)) "fizz" n))) - (set n (+ n 1)))) - - diff --git a/tests/four.bth b/tests/four.bth new file mode 100644 index 0000000..8804fe4 --- /dev/null +++ b/tests/four.bth @@ -0,0 +1 @@ +(+ 2 2) diff --git "a/tests/four.b\303\276" "b/tests/four.b\303\276" deleted file mode 100644 index 8804fe4..0000000 --- "a/tests/four.b\303\276" +++ /dev/null @@ -1 +0,0 @@ -(+ 2 2) diff --git a/tests/vars.bth b/tests/vars.bth new file mode 100644 index 0000000..7799acf --- /dev/null +++ b/tests/vars.bth @@ -0,0 +1,9 @@ +(do + (set a 5) + (set b 10) + (set thethe 1234) + (print (+ a b)) + (print (- thethe a)) + (print (+ (set a 90) b)) + (print a) + nil) diff --git "a/tests/vars.b\303\276" "b/tests/vars.b\303\276" deleted file mode 100644 index 7799acf..0000000 --- "a/tests/vars.b\303\276" +++ /dev/null @@ -1,9 +0,0 @@ -(do - (set a 5) - (set b 10) - (set thethe 1234) - (print (+ a b)) - (print (- thethe a)) - (print (+ (set a 90) b)) - (print a) - nil) -- cgit v1.2.3