mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-28 05:47:48 +00:00
Add testing for assertions inside unionized sections
This commit is contained in:
18
test/link/section-union/assert.asm
Normal file
18
test/link/section-union/assert.asm
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
IF !DEF(SECOND)
|
||||||
|
OFS = 42
|
||||||
|
ELSE
|
||||||
|
OFS = 69
|
||||||
|
ENDC
|
||||||
|
|
||||||
|
BASE = $C0DE
|
||||||
|
|
||||||
|
SECTION UNION "assertions in unions", WRAM0
|
||||||
|
IF DEF(SECOND)
|
||||||
|
assert @ != BASE, "Force failing the build" ; Force failure in RGBLINK, though
|
||||||
|
ENDC
|
||||||
|
ds OFS
|
||||||
|
assert @ == BASE + OFS, "This assertion should not trigger"
|
||||||
|
|
||||||
|
; Only make RGBASM aware of the section's location *after* it sees the assertion
|
||||||
|
; This forces it to pass it to RGBLINK
|
||||||
|
SECTION UNION "assertions in unions", WRAM0[BASE]
|
||||||
6
test/link/section-union/assert.out
Normal file
6
test/link/section-union/assert.out
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
section-union/assert.asm(11): Force failing the build
|
||||||
|
error: 1 assertions failed!
|
||||||
|
---
|
||||||
|
ERROR: -(30):
|
||||||
|
Assertion failed: Force failing the build
|
||||||
|
error: Assembly aborted (1 errors)!
|
||||||
@@ -84,7 +84,7 @@ $RGBASM -o $otemp section-union/good/a.asm
|
|||||||
$RGBASM -o $gbtemp2 section-union/good/b.asm
|
$RGBASM -o $gbtemp2 section-union/good/b.asm
|
||||||
$RGBLINK -o $gbtemp -l section-union/good/script.link $otemp $gbtemp2
|
$RGBLINK -o $gbtemp -l section-union/good/script.link $otemp $gbtemp2
|
||||||
dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-union/good/ref.out.bin)) > $otemp 2>/dev/null
|
dd if=$gbtemp count=1 bs=$(printf %s $(wc -c < section-union/good/ref.out.bin)) > $otemp 2>/dev/null
|
||||||
i="section-union.asm" tryCmp section-union/good/ref.out.bin $otemp
|
i="section-union/good.asm" tryCmp section-union/good/ref.out.bin $otemp
|
||||||
rc=$(($? || $rc))
|
rc=$(($? || $rc))
|
||||||
for i in section-union/*.asm; do
|
for i in section-union/*.asm; do
|
||||||
$RGBASM -o $otemp $i
|
$RGBASM -o $otemp $i
|
||||||
|
|||||||
Reference in New Issue
Block a user