Add some more tests, and fix some existing ones

This commit is contained in:
Rangi42
2024-08-09 22:41:20 -04:00
committed by Sylvie
parent ee3a93a442
commit 7cf4156003
17 changed files with 175 additions and 8 deletions

View File

@@ -1,2 +1,2 @@
SECTION "You lost the game", ROM0, ALIGN[17, 99]
SECTION "You lost the game", ROM0[17] ALIGN 17, 99

5
test/asm/align-large.err Normal file
View File

@@ -0,0 +1,5 @@
error: align-large.asm(1):
Alignment must be between 0 and 16, not 17
error: align-large.asm(2):
Alignment must be between 0 and 16, not 17
error: Assembly aborted (2 errors)!

3
test/asm/const-not.asm Normal file
View File

@@ -0,0 +1,3 @@
section "test", rom0, align[8]
ds 42
assert !@

3
test/asm/const-not.err Normal file
View File

@@ -0,0 +1,3 @@
error: const-not.asm(3):
Assertion failed
error: Assembly aborted (1 error)!

View File

@@ -0,0 +1,3 @@
def n equ 42
purge n
purge n

View File

@@ -0,0 +1,3 @@
error: double-purge.asm(3):
'n' was already purged
error: Assembly aborted (1 error)!

View File

@@ -1,7 +1,11 @@
opt b123 opt b123
opt g12345 opt g12345
opt pxy
opt p1234 opt p1234
opt Qxy
opt Q1234 opt Q1234
opt Q32 opt Q32
opt r99999999999999999999999999
opt W opt W
opt opt
popo

View File

@@ -5,11 +5,19 @@ error: invalid-opt.asm(2):
error: invalid-opt.asm(3): error: invalid-opt.asm(3):
Invalid argument for option 'p' Invalid argument for option 'p'
error: invalid-opt.asm(4): error: invalid-opt.asm(4):
Invalid argument for option 'Q' Invalid argument for option 'p'
error: invalid-opt.asm(5): error: invalid-opt.asm(5):
Argument for option 'Q' must be between 1 and 31 Invalid argument for option 'Q'
error: invalid-opt.asm(6): error: invalid-opt.asm(6):
Must specify an argument for option 'W' Invalid argument for option 'Q'
error: invalid-opt.asm(7): error: invalid-opt.asm(7):
Argument for option 'Q' must be between 1 and 31
error: invalid-opt.asm(8):
Argument to 'r' is out of range ("99999999999999999999999999")
error: invalid-opt.asm(9):
Must specify an argument for option 'W'
error: invalid-opt.asm(10):
syntax error, unexpected newline, expecting string syntax error, unexpected newline, expecting string
error: Assembly aborted (7 errors)! error: invalid-opt.asm(11):
No entries in the option stack
error: Assembly aborted (11 errors)!

View File

@@ -8,8 +8,7 @@ SECTION "Output", ROM0[0]
SECTION "ROM CODE",ROM0 SECTION "ROM CODE",ROM0
ds $80 ds $80
LOAD "RAM CODE",SRAM LOAD "RAM CODE",SRAM
PUSHS PUSHS "HRAM",HRAM
SECTION "HRAM",HRAM
ds 1 ds 1
POPS POPS
ENDL ENDL

View File

@@ -0,0 +1,26 @@
SECTION "test", ROM0
MACRO m
ENDM
PURGE m
m
DEF argi EQU 1
MACRO m2
println "(\<argi>)!"
ENDM
PURGE argi
m2 hello
DEF n EQU argi
PRINTLN "({argi})"
Label::
PURGE Label
DEF x = Label
DEF x = BANK(Label)
Label2::
PURGE Label2
DEF x EQUS SECTION(Label2) ; fatal

View File

@@ -0,0 +1,18 @@
error: use-purged-symbol.asm(6):
Macro "m" not defined; it was purged
error: use-purged-symbol.asm(13) -> use-purged-symbol.asm::m2(10):
Bracketed symbol "argi" does not exist; it was purged
error: use-purged-symbol.asm(15):
Expected constant expression: 'argi' is not constant at assembly time; it was purged
error: use-purged-symbol.asm(17):
Interpolated symbol "argi" does not exist; it was purged
warning: use-purged-symbol.asm(20): [-Wpurge]
Purging an exported symbol "Label"
error: use-purged-symbol.asm(21):
Expected constant expression: 'Label' is not constant at assembly time; it was purged
error: use-purged-symbol.asm(22):
Expected constant expression: "Label"'s bank is not known; it was purged
warning: use-purged-symbol.asm(25): [-Wpurge]
Purging an exported symbol "Label2"
FATAL: use-purged-symbol.asm(26):
Unknown symbol "Label2"; it was purged

View File

@@ -0,0 +1,2 @@
()!
()

27
test/link/map-file/a.asm Normal file
View File

@@ -0,0 +1,27 @@
SECTION "rom0", ROM0
Label0:: ds 1
.local::
SECTION "romx", ROMX
Label1:: ds 2
.local::
SECTION "vram", VRAM
vLabel:: ds 3
.local::
SECTION "sram", SRAM
sLabel:: ds 4
.local::
SECTION "wram0", WRAM0
wLabel0:: ds 5
.local::
SECTION "wramx", WRAMX
wLabel1:: ds 6
.local::
SECTION "hram", HRAM
hLabel:: ds 7
.local::

View File

Binary file not shown.

View File

@@ -0,0 +1,56 @@
SUMMARY:
ROM0: 1 byte used / 16383 free
ROMX: 2 bytes used / 16382 free in 1 bank
SRAM: 4 bytes used / 8188 free in 1 bank
WRAM0: 5 bytes used / 4091 free
WRAMX: 6 bytes used / 4090 free in 1 bank
HRAM: 7 bytes used / 120 free
ROM0 bank #0:
SECTION: $0000-$0000 ($0001 byte) ["rom0"]
$0000 = Label0
$0001 = Label0.local
EMPTY: $0001-$3fff ($3fff bytes)
TOTAL EMPTY: $3fff bytes
ROMX bank #1:
SECTION: $4000-$4001 ($0002 bytes) ["romx"]
$4000 = Label1
$4002 = Label1.local
EMPTY: $4002-$7fff ($3ffe bytes)
TOTAL EMPTY: $3ffe bytes
VRAM bank #0:
SECTION: $8000-$8002 ($0003 bytes) ["vram"]
$8000 = vLabel
$8003 = vLabel.local
EMPTY: $8003-$9fff ($1ffd bytes)
TOTAL EMPTY: $1ffd bytes
SRAM bank #0:
SECTION: $a000-$a003 ($0004 bytes) ["sram"]
$a000 = sLabel
$a004 = sLabel.local
EMPTY: $a004-$bfff ($1ffc bytes)
TOTAL EMPTY: $1ffc bytes
WRAM0 bank #0:
SECTION: $c000-$c004 ($0005 bytes) ["wram0"]
$c000 = wLabel0
$c005 = wLabel0.local
EMPTY: $c005-$cfff ($0ffb bytes)
TOTAL EMPTY: $0ffb bytes
WRAMX bank #1:
SECTION: $d000-$d005 ($0006 bytes) ["wramx"]
$d000 = wLabel1
$d006 = wLabel1.local
EMPTY: $d006-$dfff ($0ffa bytes)
TOTAL EMPTY: $0ffa bytes
HRAM bank #0:
SECTION: $ff80-$ff86 ($0007 bytes) ["hram"]
$ff80 = hLabel
$ff87 = hLabel.local
EMPTY: $ff87-$fffe ($0078 bytes)
TOTAL EMPTY: $0078 bytes

View File

@@ -181,6 +181,16 @@ rgblinkQuiet -o "$gbtemp2" "$outtemp"
tryCmp "$gbtemp" "$gbtemp2" tryCmp "$gbtemp" "$gbtemp2"
evaluateTest evaluateTest
test="map-file"
startTest
"$RGBASM" -o "$otemp" "$test"/a.asm
continueTest
rgblinkQuiet -o "$gbtemp" -m "$outtemp2" "$otemp" 2>"$outtemp"
tryDiff "$test"/out.err "$outtemp"
tryDiff "$test"/ref.out.map "$outtemp2"
tryCmpRom "$test"/ref.out.bin
evaluateTest
test="overlay/smaller" test="overlay/smaller"
startTest startTest
"$RGBASM" -o "$otemp" "$test"/a.asm "$RGBASM" -o "$otemp" "$test"/a.asm