diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2021-03-23 09:38:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 09:38:23 -0400 |
commit | e2838892d69c12fdafe3a40bd7386e7b26506282 (patch) | |
tree | 4eb89c1047a1aea1806b52763f05ba2846be0676 /macros/asserts.asm | |
parent | dbe2360ecd3eb11fd144168427e1323f5e1b2ec2 (diff) | |
parent | 94057c7726995b0da484a39c22497876b7c22997 (diff) |
Merge pull request #816 from Rangi42/lists
Verify uneven list sizes with list_start, li, and assert_list_length macros
Diffstat (limited to 'macros/asserts.asm')
-rw-r--r-- | macros/asserts.asm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/macros/asserts.asm b/macros/asserts.asm index 306fc4c34..04c039ecc 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -19,6 +19,31 @@ x = \1 "{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes" ENDM +list_start: MACRO +list_index = 0 +if DEF(CURRENT_LIST_START) +PURGE CURRENT_LIST_START +endc +if _NARG == 1 +CURRENT_LIST_START EQUS "\1" +else +CURRENT_LIST_START EQUS "._list_start\@" +CURRENT_LIST_START: +endc +ENDM + +li: MACRO + assert !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) + db \1, "@" +list_index = list_index + 1 +ENDM + +assert_list_length: MACRO +x = \1 + assert x == list_index, \ + "{CURRENT_LIST_START}: expected {d:x} entries, got {d:list_index}" +ENDM + def_grass_wildmons: MACRO ;\1: map id if DEF(CURRENT_GRASS_WILDMONS_MAP) |