mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Implement ++ operator for string concatenation (#1698)
This commit is contained in:
26
test/asm/string-concat.asm
Normal file
26
test/asm/string-concat.asm
Normal file
@@ -0,0 +1,26 @@
|
||||
SECTION "test", ROM0
|
||||
|
||||
MACRO test
|
||||
assert !strcmp(\1, \2)
|
||||
ENDM
|
||||
|
||||
test "a"++"b", "ab"
|
||||
test "a"++""++"b", "ab"
|
||||
test "a"++"b", strcat("a", "b")
|
||||
test "a"++"b"++"c", strcat("a","b","c")
|
||||
test "" ++ "", ""
|
||||
test strupr("a") ++ strlwr("B"), "Ab"
|
||||
|
||||
def str equs "hi"
|
||||
test #str ++ strupr(#str), "hiHI"
|
||||
test "a" ++ """b""" ++ strupr("c") ++ strslice(#str, 0, 0), "abC"
|
||||
|
||||
charmap "a", 1
|
||||
charmap "b", 2
|
||||
charmap "ab", 12
|
||||
assert "a" + "b" == 3
|
||||
assert "a" ++ "b" == 12
|
||||
|
||||
; errors
|
||||
assert 2 ++ 2 == 4
|
||||
ld a, [hl++]
|
||||
Reference in New Issue
Block a user