mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Implement CHARVAL function (#1701)
This commit is contained in:
23
test/asm/charval.asm
Normal file
23
test/asm/charval.asm
Normal file
@@ -0,0 +1,23 @@
|
||||
charmap "a", 1
|
||||
charmap "b", 2, 3
|
||||
charmap "cdef", 4
|
||||
charmap "ghi", 5, 6, 7, 8, 9
|
||||
charmap "jkl", 123, 456, 789
|
||||
charmap "mno", 123456789
|
||||
|
||||
assert charval("a", 0) == 1
|
||||
assert charval("a", -1) == 1
|
||||
assert charval("b", 0) == 2
|
||||
assert charval("b", 1) == 3
|
||||
assert charval("b", -1) == 3
|
||||
assert charval("b", -2) == 2
|
||||
assert charval("cdef", 0) == 4
|
||||
assert charval("ghi", 2) == charval("ghi", -3)
|
||||
assert charval("jkl", -1) == 789
|
||||
assert charval("mno", 0) == 123456789
|
||||
|
||||
assert charval("abc", 0) == 0
|
||||
assert charval("cd", 1) == 0
|
||||
assert charval("xyz", 2) == 0
|
||||
assert charval("ghi", -10) == 5
|
||||
assert charval("ghi", 10) == 0
|
||||
11
test/asm/charval.err
Normal file
11
test/asm/charval.err
Normal file
@@ -0,0 +1,11 @@
|
||||
error: charval.asm(19):
|
||||
CHARVAL: No character mapping for "abc"
|
||||
error: charval.asm(20):
|
||||
CHARVAL: No character mapping for "cd"
|
||||
error: charval.asm(21):
|
||||
CHARVAL: No character mapping for "xyz"
|
||||
warning: charval.asm(22): [-Wbuiltin-args]
|
||||
CHARVAL: Index starts at 0
|
||||
warning: charval.asm(23): [-Wbuiltin-args]
|
||||
CHARVAL: Index 10 is past the end of the character mapping
|
||||
error: Assembly aborted (3 errors)!
|
||||
Reference in New Issue
Block a user