added a few more tests and Makefiles to automate them

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@336 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2024-02-14 00:49:01 +00:00
parent 444c7e858f
commit 5b3557841e
15 changed files with 99 additions and 8 deletions

13
testing/Makefile Normal file
View File

@ -0,0 +1,13 @@
.SILENT:
all:
echo "Testing CPUs..."
echo
make -C cpus
echo "Testing errors..."
echo
make -C errors
echo "Testing warnings..."
echo
make -C warnings

17
testing/cpus/Makefile Normal file
View File

@ -0,0 +1,17 @@
ACMEFLAGS = -v0
CPUS := $(subst .a,,$(subst test-,,$(wildcard test-*.a)))
FILES = $(foreach N,$(CPUS),$(N).o)
.SILENT:
%.o: test-%.a
echo "Testing CPU:" $(subst .o,,$@)
acme $(ACMEFLAGS) -o test.o $<
cmp test.o expected-$@
rm test.o
echo "Ok."
all: $(FILES)
echo
echo "Testing CPUs: PASSED"
echo

View File

@ -1,8 +0,0 @@
#!/bin/bash
for CPU in 6502 65c02 r65c02 w65c02 nmos6502 c64dtv2 65ce02 4502 m65 65816 ; do
acme -v0 test-"$CPU".a || exit
cmp out-"$CPU".o expected-"$CPU".o || exit
done
echo
echo "All CPU tests passed successfully."
echo

15
testing/errors/Makefile Normal file
View File

@ -0,0 +1,15 @@
ACMEFLAGS = -v0
FILES := $(wildcard *.a)
TESTS = $(subst .a,.test,$(FILES))
.SILENT:
%.test: %.a
echo "Testing error generation:" $<
! acme $(ACMEFLAGS) $<
echo "Ok."
all: $(TESTS)
echo
echo "Testing errors: PASSED"
echo

View File

@ -0,0 +1 @@
a = 3 != [] ; -> "Operation not supported."

View File

@ -0,0 +1 @@
b = "str" = [] ; -> "Operation not supported."

View File

@ -0,0 +1 @@
c = [] + 3 ; -> "Operation not supported."

View File

@ -0,0 +1,2 @@
* = $200
!by .local ; -> "Value not defined."

View File

@ -0,0 +1,2 @@
* = $200
!by @cheap_local ; -> "Value not defined."

21
testing/warnings/Makefile Normal file
View File

@ -0,0 +1,21 @@
ACMEFLAGS = -v0
FILES := $(wildcard *.a)
FAILTESTS = $(subst .a,.fail,$(FILES))
SUCCTESTS = $(subst .a,.succ,$(FILES))
.SILENT:
%.fail: %.a
echo "Testing warning with --strict:" $<
! acme $(ACMEFLAGS) --strict $<
echo "Ok."
%.succ: %.a
echo "Testing warning:" $<
acme $(ACMEFLAGS) $<
echo "Ok."
all: $(FAILTESTS) $(SUCCTESTS)
echo
echo "Testing warnings: PASSED"
echo

View File

@ -0,0 +1,2 @@
!initmem 0
!initmem 0 ; -> "Memory already initialised."

6
testing/warnings/limit.a Normal file
View File

@ -0,0 +1,6 @@
*=$1000
!tx "Hinz"
!outfilelimit
!tx "Kunz"
!outfilelimit ; -> "End of output file already chosen."
!tx "Bla"

View File

@ -0,0 +1,6 @@
*=$1000
clc
nop
rts
*=$1001
brk ; -> "Segment starts inside another one, overwriting it."

View File

@ -0,0 +1,6 @@
*=$1001
brk
*=$1000
clc
nop ; -> "Segment reached another one, overwriting it."
rts

6
testing/warnings/start.a Normal file
View File

@ -0,0 +1,6 @@
*=$1000
!tx "Hinz"
!outfilestart
!tx "Kunz"
!outfilestart ; -> "Start of output file already chosen."
!tx "Bla"