more test files

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@342 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2024-02-18 13:50:32 +00:00
parent 36653b8cf1
commit 58b04ba77c
24 changed files with 79 additions and 18 deletions

22
testing/auto/iterables.a Normal file
View File

@ -0,0 +1,22 @@
!macro a @r {
!if @r != 1 {
!error "assertion failed"
}
}
squares = [1, 4, 9]
emptylist = []
primes = [2, 3, 5, 7]
+a primes + emptylist + squares == [2,3,5,7,1,4,9]
somestring = "Arthur"
emptystring = ""
otherstring = "Ford"
+a otherstring + emptystring + somestring == "FordArthur"
collection = []
!for c in "Trillian" {
!set collection = collection + [c]
}
+a collection == [84, 114, 105, 108, 108, 105, 97, 110]

36
testing/auto/postfix.a Normal file
View File

@ -0,0 +1,36 @@
!macro a @r {
!if @r != 1 {
!error "postfix did not work"
}
}
*=$1000
a = 3
a+2 = 3 ; symbol has not been read, so adding postfix should work
label
label+2 ; label has not been read, so adding postfix should work
!set b+2 = 17
label2
lda b
+a * - label2 == 3
label3
!for c+2, 17, 17 {
lda c
}
+a * - label3 == 3
d+2 = 17
!set d+2 = 17
label4
lda d
+a * - label4 == 3
label5
e+2=5
!for e+2, 17, 17 {
lda e
}
+a * - label5 == 3
label6
f+3 = 17
!for g+2, f, f {
lda g
}
+a * - label6 == 3

View File

@ -9,6 +9,6 @@ all: outformats
echo "Testing cliargs: PASSED" echo "Testing cliargs: PASSED"
echo echo
outformats: outformats.a outformats.sh outformat-*.o outformats: outformats.a outformats.sh outformat-*.exp
echo "Testing output formats:" echo "Testing output formats:"
bash outformats.sh bash outformats.sh

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
<EFBFBD>`

View File

@ -10,5 +10,5 @@
!error "unexpected FORMAT" !error "unexpected FORMAT"
} }
*=$1000 *=$1000
lda #1 lda #0
rts rts

View File

@ -10,18 +10,18 @@ check() {
} }
# if neither -o nor -f are given, use format from "!to", which defaults to cbm: # if neither -o nor -f are given, use format from "!to", which defaults to cbm:
check outformat-cbm.o -DFORMAT=0 check outformat-cbm.exp -DFORMAT=0
check outformat-plain.o -DFORMAT=1 check outformat-plain.exp -DFORMAT=1
check outformat-cbm.o -DFORMAT=2 check outformat-cbm.exp -DFORMAT=2
check outformat-apple.o -DFORMAT=3 check outformat-apple.exp -DFORMAT=3
# if -o or -f are given, format from "!to" should be ignored: # if -o or -f are given, format from "!to" should be ignored:
for f in 0 1 2 3 ; do for f in 0 1 2 3 ; do
check outformat-plain.o -DFORMAT=$f -f plain check outformat-plain.exp -DFORMAT=$f -f plain
check outformat-cbm.o -DFORMAT=$f -f cbm check outformat-cbm.exp -DFORMAT=$f -f cbm
check outformat-apple.o -DFORMAT=$f -f apple check outformat-apple.exp -DFORMAT=$f -f apple
check outformat-plain.o -DFORMAT=$f -o test.o # defaults to plain check outformat-plain.exp -DFORMAT=$f -o test.o # defaults to plain
check outformat-plain.o -DFORMAT=$f -o test.o -f plain check outformat-plain.exp -DFORMAT=$f -o test.o -f plain
check outformat-cbm.o -DFORMAT=$f -o test.o -f cbm check outformat-cbm.exp -DFORMAT=$f -o test.o -f cbm
check outformat-apple.o -DFORMAT=$f -o test.o -f apple check outformat-apple.exp -DFORMAT=$f -o test.o -f apple
done done

View File

@ -1,13 +1,13 @@
ACMEFLAGS = -v0 ACMEFLAGS = -v0
CPUS := $(subst .a,,$(subst test-,,$(wildcard test-*.a))) CPUS := $(subst .a,,$(subst test-,,$(wildcard test-*.a)))
FILES = $(foreach N,$(CPUS),$(N).o) FILES = $(foreach N,$(CPUS),$(N).exp)
.SILENT: .SILENT:
%.o: test-%.a %.exp: test-%.a
echo "Testing CPU:" $(subst .o,,$@) echo "Testing CPU:" $(subst .exp,,$@)
acme $(ACMEFLAGS) -o test.o $< acme $(ACMEFLAGS) -o test.o $<
cmp test.o expected-$@ cmp test.o out-$@
$(RM) test.o $(RM) test.o
echo "Ok." echo "Ok."

View File

@ -0,0 +1,2 @@
*=$1000
lda #"" ; -> "String length is not 1."

View File

@ -0,0 +1,2 @@
*=$1000
lda #"aa" ; -> "String length is not 1."