mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-22 17:32:01 +00:00
Add more tests.
This commit is contained in:
parent
3814d2624d
commit
d598b505e0
@ -3223,6 +3223,103 @@ Here, we declare that main outputs a, and we goto a routine that outputs a so th
|
||||
| }
|
||||
= ok
|
||||
|
||||
Here, we declare that main outputs `a`, and we `goto` two routines, and they both output `a`.
|
||||
|
||||
| define bar0 routine
|
||||
| inputs x
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld a, x
|
||||
| }
|
||||
|
|
||||
| define bar1 routine
|
||||
| inputs x
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld a, 200
|
||||
| }
|
||||
|
|
||||
| define main routine
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld x, 0
|
||||
| if z {
|
||||
| ld x, 1
|
||||
| goto bar0
|
||||
| } else {
|
||||
| ld x, 2
|
||||
| goto bar1
|
||||
| }
|
||||
| }
|
||||
= ok
|
||||
|
||||
Here is like just above, but one routine doesn't output `a`.
|
||||
|
||||
| define bar0 routine
|
||||
| inputs x
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld a, x
|
||||
| }
|
||||
|
|
||||
| define bar1 routine
|
||||
| inputs x
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld x, 200
|
||||
| }
|
||||
|
|
||||
| define main routine
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld x, 0
|
||||
| if z {
|
||||
| ld x, 1
|
||||
| goto bar0
|
||||
| } else {
|
||||
| ld x, 2
|
||||
| goto bar1
|
||||
| }
|
||||
| }
|
||||
? InconsistentExitError
|
||||
|
||||
Here is like the above, but the two routines have different inputs, and that's OK.
|
||||
|
||||
| define bar0 routine
|
||||
| inputs x
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld a, x
|
||||
| }
|
||||
|
|
||||
| define bar1 routine
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld a, 200
|
||||
| }
|
||||
|
|
||||
| define main routine
|
||||
| outputs a
|
||||
| trashes x, z, n
|
||||
| {
|
||||
| ld x, 0
|
||||
| if z {
|
||||
| ld x, 1
|
||||
| goto bar0
|
||||
| } else {
|
||||
| ld x, 2
|
||||
| goto bar1
|
||||
| }
|
||||
| }
|
||||
= ok
|
||||
|
||||
TODO: we should have a lot more test cases for the above, here.
|
||||
|
||||
Can't `goto` a routine that outputs or trashes more than the current routine.
|
||||
|
Loading…
Reference in New Issue
Block a user