mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Consistently do & alignMask, not % alignSize
Also add more unrelated tests for coverage
This commit is contained in:
@@ -4,12 +4,25 @@ def s equs "Hello world!"
|
||||
assert strin(#s, "l") == strfind(#s, "l") + 1
|
||||
assert strrin(#s, "l") == strrfind(#s, "l") + 1
|
||||
|
||||
assert !strcmp(strsub(#s, 7), strslice(#s, 6))
|
||||
assert !strcmp(strsub(#s, 7, 5), strslice(#s, 6, 11))
|
||||
assert !strcmp(strsub(#s, strlen(#s), 1), strslice(#s, strlen(#s) - 1, strlen(#s)))
|
||||
assert !strcmp(strsub(#s, 7, 999), strslice(#s, 6, 999))
|
||||
assert strsub(#s, 7) === strslice(#s, 6)
|
||||
assert strsub(#s, 7, 5) === strslice(#s, 6, 11)
|
||||
assert strsub(#s, strlen(#s), 1) === strslice(#s, strlen(#s) - 1, strlen(#s))
|
||||
assert strsub(#s, 7, 999) === strslice(#s, 6, 999)
|
||||
|
||||
assert !strcmp(charsub(#s, 12), strchar(#s, 11))
|
||||
assert !strcmp(charsub(#s, -1), strchar(#s, -1))
|
||||
assert !strcmp(charsub(#s, -999), strchar(#s, -999))
|
||||
assert !strcmp(charsub(#s, 999), strchar(#s, 999))
|
||||
assert charsub(#s, 12) === strchar(#s, 11)
|
||||
assert charsub(#s, -1) === strchar(#s, -1)
|
||||
assert charsub(#s, -999) === strchar(#s, -999)
|
||||
assert charsub(#s, 999) === strchar(#s, 999)
|
||||
|
||||
; characters:
|
||||
; 1: U+0061 a
|
||||
; 2: U+00E4 a with diaresis (0xC3 0xA4)
|
||||
; 3: U+0062 b
|
||||
; 4: invalid byte 0xA3
|
||||
; 5: U+0063 c
|
||||
; 6: incomplete U+6F22 kanji (0xE6 0xBC without 0xA2)
|
||||
def invalid equs "aäb<C3A4>c<EFBFBD><63>"
|
||||
|
||||
def copy equs strsub(#invalid, 1)
|
||||
def past equs strsub(#invalid, 9, 1)
|
||||
def incomplete equs strsub(#invalid, 12, 1)
|
||||
|
||||
@@ -30,3 +30,26 @@ warning: CHARSUB: Position 999 is past the end of the string [-Wbuiltin-args]
|
||||
at deprecated-functions.asm(15)
|
||||
warning: STRCHAR: Index 999 is past the end of the string [-Wbuiltin-args]
|
||||
at deprecated-functions.asm(15)
|
||||
warning: `STRSUB` is deprecated; use 0-indexed `STRSLICE` instead [-Wobsolete]
|
||||
at deprecated-functions.asm(26)
|
||||
error: STRSUB: Invalid UTF-8 byte 0xA3
|
||||
at deprecated-functions.asm(26)
|
||||
error: STRSUB: Incomplete UTF-8 character
|
||||
at deprecated-functions.asm(26)
|
||||
warning: `STRSUB` is deprecated; use 0-indexed `STRSLICE` instead [-Wobsolete]
|
||||
at deprecated-functions.asm(27)
|
||||
error: STRSUB: Invalid UTF-8 byte 0xA3
|
||||
at deprecated-functions.asm(27)
|
||||
warning: STRSUB: Position 9 is past the end of the string [-Wbuiltin-args]
|
||||
at deprecated-functions.asm(27)
|
||||
error: STRSUB: Incomplete UTF-8 character
|
||||
at deprecated-functions.asm(27)
|
||||
warning: `STRSUB` is deprecated; use 0-indexed `STRSLICE` instead [-Wobsolete]
|
||||
at deprecated-functions.asm(28)
|
||||
error: STRSUB: Invalid UTF-8 byte 0xA3
|
||||
at deprecated-functions.asm(28)
|
||||
warning: STRSUB: Position 12 is past the end of the string [-Wbuiltin-args]
|
||||
at deprecated-functions.asm(28)
|
||||
error: STRSUB: Incomplete UTF-8 character
|
||||
at deprecated-functions.asm(28)
|
||||
Assembly aborted with 6 errors!
|
||||
|
||||
4
test/asm/incbin-start-bad.asm
Normal file
4
test/asm/incbin-start-bad.asm
Normal file
@@ -0,0 +1,4 @@
|
||||
SECTION "Bad", ROM0
|
||||
|
||||
INCBIN "data.bin", 999
|
||||
INCBIN "data.bin", 999, 1
|
||||
5
test/asm/incbin-start-bad.err
Normal file
5
test/asm/incbin-start-bad.err
Normal file
@@ -0,0 +1,5 @@
|
||||
error: Specified start position is greater than length of file "data.bin"
|
||||
at incbin-start-bad.asm(3)
|
||||
error: Specified start position is greater than length of file "data.bin"
|
||||
at incbin-start-bad.asm(4)
|
||||
Assembly aborted with 2 errors!
|
||||
10
test/link/section-fragment/align-conflict.asm
Normal file
10
test/link/section-fragment/align-conflict.asm
Normal file
@@ -0,0 +1,10 @@
|
||||
IF !DEF(SECOND)
|
||||
def ATTRS equs ",ALIGN[2]"
|
||||
ELSE
|
||||
def ATTRS equs "[$1337]"
|
||||
ENDC
|
||||
|
||||
SECTION FRAGMENT "conflicting alignment", ROM0 {ATTRS}
|
||||
db
|
||||
|
||||
PURGE ATTRS
|
||||
10
test/link/section-fragment/align-conflict.out
Normal file
10
test/link/section-fragment/align-conflict.out
Normal file
@@ -0,0 +1,10 @@
|
||||
FATAL: Section "conflicting alignment" is defined with 4-byte alignment (offset 0), but also with address $1337
|
||||
at section-fragment/align-conflict.asm(7)
|
||||
and also:
|
||||
at section-fragment/align-conflict.asm(7)
|
||||
Linking aborted with 1 error
|
||||
---
|
||||
error: Section already declared as aligned to 4 bytes (offset 0)
|
||||
at <stdin>(18)
|
||||
FATAL: Cannot create section "conflicting alignment" (1 error)
|
||||
at <stdin>(18)
|
||||
@@ -401,7 +401,7 @@ tryDiff "$test"/out.err "$outtemp"
|
||||
tryCmpRom "$test"/ref.out.bin
|
||||
evaluateTest
|
||||
|
||||
for i in section-union/*.asm; do
|
||||
for i in section-union/*.asm section-fragment/*.asm; do
|
||||
test=${i%.asm}
|
||||
startTest
|
||||
"$RGBASM" -o "$otemp" "${test}.asm"
|
||||
|
||||
Reference in New Issue
Block a user