mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-25 12:32:07 +00:00
Implement new string functions (#1655)
`STRFIND`, `STRRFIND`, `STRCHAR`, `STRSLICE`, `CHARCMP`, `CHARSIZE`, and `REVCHAR`
This commit is contained in:
27
test/asm/charcmp.asm
Normal file
27
test/asm/charcmp.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
charmap "a", 1
|
||||
charmap "b", 2
|
||||
charmap "c", 0
|
||||
charmap "w", 3, 2, 1
|
||||
charmap "x", 1, 2
|
||||
charmap "y", 2, 1
|
||||
charmap "z", 1, 2, 3
|
||||
|
||||
macro test
|
||||
println strfmt("\"%#s\" <=> \"%#s\" == %d", \1, \2, charcmp(\1, \2))
|
||||
endm
|
||||
|
||||
test "", ""
|
||||
test "a", "a"
|
||||
test "aa", "aaa"
|
||||
test "aaa", "aa"
|
||||
test "a", "b"
|
||||
test "b", "a"
|
||||
test "", "b"
|
||||
test "c", ""
|
||||
test "abc", "cba"
|
||||
test "cabc", "cxc"
|
||||
test "zy", "abw"
|
||||
test "abab", "xx"
|
||||
test "abab", "ww"
|
||||
test "w", "z"
|
||||
test "xcy", "zw"
|
||||
Reference in New Issue
Block a user