Permalink
Browse files

More test cases, all tests pass now

  • Loading branch information...
1 parent d0be456 commit 4f92d7033705634a1f53da0bd723012ac4690fec @jonpovey committed May 15, 2012
@@ -1,9 +1,9 @@
-warning: Unused symbol 'end'
-warning: Value -65535(0xffff0001) does not fit in 16 bits, masked to 0x1
-warning: Value 65566(0x1001e) does not fit in 16 bits, masked to 0x1e
-warning: Value -32769(0xffff7fff) does not fit in 16 bits, masked to 0x7fff
-warning: Value 65536(0x10000) does not fit in 16 bits, masked to 0x0
-warning: Value -65535(0xffff0001) does not fit in 16 bits, masked to 0x1
-warning: Value 65566(0x1001e) does not fit in 16 bits, masked to 0x1e
-warning: Value -32769(0xffff7fff) does not fit in 16 bits, masked to 0x7fff
-warning: Value 65536(0x10000) does not fit in 16 bits, masked to 0x0
+Warning: line 33: Unused symbol 'end'
+Warning: Value -65535(0xffff0001) does not fit in 16 bits, masked to 0x1
+Warning: Value 65566(0x1001e) does not fit in 16 bits, masked to 0x1e
+Warning: Value -32769(0xffff7fff) does not fit in 16 bits, masked to 0x7fff
+Warning: Value 65536(0x10000) does not fit in 16 bits, masked to 0x0
+Warning: Value -65535(0xffff0001) does not fit in 16 bits, masked to 0x1
+Warning: Value 65566(0x1001e) does not fit in 16 bits, masked to 0x1e
+Warning: Value -32769(0xffff7fff) does not fit in 16 bits, masked to 0x7fff
+Warning: Value 65536(0x10000) does not fit in 16 bits, masked to 0x0
@@ -1 +0,0 @@
-warning: Unused symbol 'jon1'
@@ -14,5 +14,4 @@
0013 SET PC, crash ; df81
0014 :testsub SHL X, 4 ; 946f
0015 SET PC, POP ; 6381
-0016 :jon1
0016 :crash SET PC, crash ; df81
@@ -22,7 +22,6 @@
:testsub SHL X, 4 ; 9037
SET PC, POP ; 61c1
-:jon1
; Hang forever. X should now be 0x40 if everything went right.
:crash SET PC, crash ; 7dc1 001a [*]
@@ -0,0 +1 @@
+EXPECT_FAILURE
@@ -0,0 +1,4 @@
+Warning: Literal value used as destination
+line 4: Error: syntax error, unexpected ',', expecting '\n'
+line 6: Error: syntax error, unexpected '\n'
+Aborting from parse error
@@ -0,0 +1,7 @@
+; some syntax errors
+; SET SET, MUL
+; total nonsense
+ SET too, many, arguments
+ SET ; accidentaly a semicolon
+
+
@@ -0,0 +1 @@
+EXPECT_FAILURE
@@ -0,0 +1,5 @@
+Error: line 8: symbol 'mix' already defined at line 8
+Error: line 10: symbol 'explicit' already defined at line 9
+Error: line 19: symbol 'redef' already defined at line 18
+Error: line 21: symbol 'redef' already defined at line 18
+Aborting from parse error
@@ -0,0 +1,27 @@
+; test symbol parse errors
+; parse-time errors are:
+; redefined symbols. symbols can be defined by labels or .equ
+
+
+:unused_zeroA
+:unused_zeroB SET a,b
+:mix .equ mix, 1 ; ERROR redefine on the same line
+ .equ explicit, 69
+ .equ explicit, 1 ; ERROR redefined
+
+:second JSR nonexist ; error undefined symbol. this is currently
+ ; a validation time error which is never
+ ; hit for this test as das aborts after
+ ; finding parse errors
+ SUB a, second
+:unused_3
+:redef XOR [data], b
+:redef XOR x, [y + data] ; ERROR label redefined
+ JSR redef
+ .equ redef, 3 ; ERROR redefining (a label)
+
+ .equ circle, circle ; circular reference not noticed at this
+ ; stage of parsing
+
+:data
+:unused_end
@@ -0,0 +1 @@
+EXPECT_FAILURE
@@ -0,0 +1,5 @@
+Warning: line 6: Unused symbol 'unused_zeroA'
+Warning: line 7: Unused symbol 'unused_zeroB'
+Error: Undefined symbol 'nonexist'
+Warning: line 18: Unused symbol 'unused_end'
+Aborting from validation error
@@ -0,0 +1,18 @@
+; test symbol validation errors
+; this test passes parsing, tested in 005
+; - warnings on unused symbols
+; - errors referencing undefined symbols
+
+:unused_zeroA
+:unused_zeroB SET a,b
+:second JSR nonexist ; error undefined symbol.
+ SUB a, second
+:loop
+ XOR [data], b
+ XOR x, [y + data]
+ SET PC, loop
+
+ .equ circle, circle ; circular reference not noticed at this
+ ; stage of parsing
+:data
+:unused_end
@@ -0,0 +1,2 @@
+; test little-endian binary saving
+DAS_FLAGS = --le
No changes.
@@ -0,0 +1,17 @@
+0000 SET A, 0x30 ; 7c01 0030
+0002 SET [0x1000], 0x20 ; 7fc1 0020 1000
+0005 SUB A, [0x1000] ; 7803 1000
+0007 IFN A, 0x10 ; c413
+0008 SET PC, crash ; df81
+0009 SET I, 10 ; acc1
+000a SET A, 0x2000 ; 7c01 2000
+000c :loop SET [I + 0x2000], [A] ; 22c1 2000
+000e SUB I, 1 ; 88c3
+000f IFN I, 0 ; 84d3
+0010 SET PC, loop ; b781
+0011 SET X, 4 ; 9461
+0012 JSR testsub ; d420
+0013 SET PC, crash ; df81
+0014 :testsub SHL X, 4 ; 946f
+0015 SET PC, POP ; 6381
+0016 :crash SET PC, crash ; df81
@@ -0,0 +1,27 @@
+; Test little-endian output.
+; Notch's original test code
+
+; Try some basic stuff
+ SET A, 0x30 ; 7c01 0030
+ SET [0x1000], 0x20 ; 7de1 1000 0020
+ SUB A, [0x1000] ; 7803 1000
+ IFN A, 0x10 ; c00d
+ SET PC, crash ; 7dc1 001a [*]
+
+; Do a loopy thing
+ SET I, 10 ; a861
+ SET A, 0x2000 ; 7c01 2000
+:loop SET [0x2000+I], [A] ; 2161 2000
+ SUB I, 1 ; 8463
+ IFN I, 0 ; 806d
+ SET PC, loop ; 7dc1 000d [*]
+
+; Call a subroutine
+ SET X, 0x4 ; 9031
+ JSR testsub ; 7c10 0018 [*]
+ SET PC, crash ; 7dc1 001a [*]
+
+:testsub SHL X, 4 ; 9037
+ SET PC, POP ; 61c1
+; Hang forever. X should now be 0x40 if everything went right.
+:crash SET PC, crash ; 7dc1 001a [*]
Binary file not shown.
View
@@ -1,13 +0,0 @@
-; test label errors
-
-:zero
-:alsozero
-:zero3 SET a,b
-:second JSR nonexist ; error undefined symbol
- SUB a, second
-:should_be_3
-:redef XOR [data], b
-:redef XOR x, [y + data] ; error label redefined
- JSR redef
-:data
-:end

0 comments on commit 4f92d70

Please sign in to comment.