diff --git a/testing/auto/iterables.a b/testing/auto/iterables.a new file mode 100644 index 0000000..119d5ae --- /dev/null +++ b/testing/auto/iterables.a @@ -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] diff --git a/testing/auto/postfix.a b/testing/auto/postfix.a new file mode 100644 index 0000000..17dd228 --- /dev/null +++ b/testing/auto/postfix.a @@ -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 diff --git a/testing/cliargs/Makefile b/testing/cliargs/Makefile index 553d5fa..c149590 100644 --- a/testing/cliargs/Makefile +++ b/testing/cliargs/Makefile @@ -9,6 +9,6 @@ all: outformats echo "Testing cliargs: PASSED" echo -outformats: outformats.a outformats.sh outformat-*.o +outformats: outformats.a outformats.sh outformat-*.exp echo "Testing output formats:" bash outformats.sh diff --git a/testing/cliargs/outformat-apple.exp b/testing/cliargs/outformat-apple.exp new file mode 100644 index 0000000..e497438 Binary files /dev/null and b/testing/cliargs/outformat-apple.exp differ diff --git a/testing/cliargs/outformat-apple.o b/testing/cliargs/outformat-apple.o deleted file mode 100644 index 5a44047..0000000 Binary files a/testing/cliargs/outformat-apple.o and /dev/null differ diff --git a/testing/cliargs/outformat-cbm.exp b/testing/cliargs/outformat-cbm.exp new file mode 100644 index 0000000..2343f8c Binary files /dev/null and b/testing/cliargs/outformat-cbm.exp differ diff --git a/testing/cliargs/outformat-cbm.o b/testing/cliargs/outformat-cbm.o deleted file mode 100644 index 7ea9830..0000000 Binary files a/testing/cliargs/outformat-cbm.o and /dev/null differ diff --git a/testing/cliargs/outformat-plain.exp b/testing/cliargs/outformat-plain.exp new file mode 100644 index 0000000..ba1be96 Binary files /dev/null and b/testing/cliargs/outformat-plain.exp differ diff --git a/testing/cliargs/outformat-plain.o b/testing/cliargs/outformat-plain.o deleted file mode 100644 index da8464e..0000000 --- a/testing/cliargs/outformat-plain.o +++ /dev/null @@ -1 +0,0 @@ -©` \ No newline at end of file diff --git a/testing/cliargs/outformats.a b/testing/cliargs/outformats.a index 69c2f8b..91f12af 100644 --- a/testing/cliargs/outformats.a +++ b/testing/cliargs/outformats.a @@ -10,5 +10,5 @@ !error "unexpected FORMAT" } *=$1000 - lda #1 + lda #0 rts diff --git a/testing/cliargs/outformats.sh b/testing/cliargs/outformats.sh index 91026e9..bc6d566 100755 --- a/testing/cliargs/outformats.sh +++ b/testing/cliargs/outformats.sh @@ -10,18 +10,18 @@ check() { } # if neither -o nor -f are given, use format from "!to", which defaults to cbm: -check outformat-cbm.o -DFORMAT=0 -check outformat-plain.o -DFORMAT=1 -check outformat-cbm.o -DFORMAT=2 -check outformat-apple.o -DFORMAT=3 +check outformat-cbm.exp -DFORMAT=0 +check outformat-plain.exp -DFORMAT=1 +check outformat-cbm.exp -DFORMAT=2 +check outformat-apple.exp -DFORMAT=3 # if -o or -f are given, format from "!to" should be ignored: for f in 0 1 2 3 ; do - check outformat-plain.o -DFORMAT=$f -f plain - check outformat-cbm.o -DFORMAT=$f -f cbm - check outformat-apple.o -DFORMAT=$f -f apple - check outformat-plain.o -DFORMAT=$f -o test.o # defaults to plain - check outformat-plain.o -DFORMAT=$f -o test.o -f plain - check outformat-cbm.o -DFORMAT=$f -o test.o -f cbm - check outformat-apple.o -DFORMAT=$f -o test.o -f apple + check outformat-plain.exp -DFORMAT=$f -f plain + check outformat-cbm.exp -DFORMAT=$f -f cbm + check outformat-apple.exp -DFORMAT=$f -f apple + check outformat-plain.exp -DFORMAT=$f -o test.o # defaults to plain + check outformat-plain.exp -DFORMAT=$f -o test.o -f plain + check outformat-cbm.exp -DFORMAT=$f -o test.o -f cbm + check outformat-apple.exp -DFORMAT=$f -o test.o -f apple done diff --git a/testing/cpus/Makefile b/testing/cpus/Makefile index 062a47a..b796bcd 100644 --- a/testing/cpus/Makefile +++ b/testing/cpus/Makefile @@ -1,13 +1,13 @@ ACMEFLAGS = -v0 CPUS := $(subst .a,,$(subst test-,,$(wildcard test-*.a))) -FILES = $(foreach N,$(CPUS),$(N).o) +FILES = $(foreach N,$(CPUS),$(N).exp) .SILENT: -%.o: test-%.a - echo "Testing CPU:" $(subst .o,,$@) +%.exp: test-%.a + echo "Testing CPU:" $(subst .exp,,$@) acme $(ACMEFLAGS) -o test.o $< - cmp test.o expected-$@ + cmp test.o out-$@ $(RM) test.o echo "Ok." diff --git a/testing/cpus/expected-4502.o b/testing/cpus/out-4502.exp similarity index 100% rename from testing/cpus/expected-4502.o rename to testing/cpus/out-4502.exp diff --git a/testing/cpus/expected-6502.o b/testing/cpus/out-6502.exp similarity index 100% rename from testing/cpus/expected-6502.o rename to testing/cpus/out-6502.exp diff --git a/testing/cpus/expected-65816.o b/testing/cpus/out-65816.exp similarity index 100% rename from testing/cpus/expected-65816.o rename to testing/cpus/out-65816.exp diff --git a/testing/cpus/expected-65c02.o b/testing/cpus/out-65c02.exp similarity index 100% rename from testing/cpus/expected-65c02.o rename to testing/cpus/out-65c02.exp diff --git a/testing/cpus/expected-65ce02.o b/testing/cpus/out-65ce02.exp similarity index 100% rename from testing/cpus/expected-65ce02.o rename to testing/cpus/out-65ce02.exp diff --git a/testing/cpus/expected-c64dtv2.o b/testing/cpus/out-c64dtv2.exp similarity index 100% rename from testing/cpus/expected-c64dtv2.o rename to testing/cpus/out-c64dtv2.exp diff --git a/testing/cpus/expected-m65.o b/testing/cpus/out-m65.exp similarity index 100% rename from testing/cpus/expected-m65.o rename to testing/cpus/out-m65.exp diff --git a/testing/cpus/expected-nmos6502.o b/testing/cpus/out-nmos6502.exp similarity index 100% rename from testing/cpus/expected-nmos6502.o rename to testing/cpus/out-nmos6502.exp diff --git a/testing/cpus/expected-r65c02.o b/testing/cpus/out-r65c02.exp similarity index 100% rename from testing/cpus/expected-r65c02.o rename to testing/cpus/out-r65c02.exp diff --git a/testing/cpus/expected-w65c02.o b/testing/cpus/out-w65c02.exp similarity index 100% rename from testing/cpus/expected-w65c02.o rename to testing/cpus/out-w65c02.exp diff --git a/testing/errors/stringlength1.a b/testing/errors/stringlength1.a new file mode 100644 index 0000000..7617818 --- /dev/null +++ b/testing/errors/stringlength1.a @@ -0,0 +1,2 @@ + *=$1000 + lda #"" ; -> "String length is not 1." diff --git a/testing/errors/stringlength2.a b/testing/errors/stringlength2.a new file mode 100644 index 0000000..e2ad23f --- /dev/null +++ b/testing/errors/stringlength2.a @@ -0,0 +1,2 @@ + *=$1000 + lda #"aa" ; -> "String length is not 1."