-
Notifications
You must be signed in to change notification settings - Fork 854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more assert cases in the codebase #1115
Conversation
Neat, want to do a couple dozen more? Also, similar assert PokemonPicPointers == UnownPicPointers
ld hl, PokemonPicPointers assert BUG_CONTEST_PLAYER == 1
dec a assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
xor a ; LOW(SERIAL_LINK_BYTE_TIMEOUT) |
Yeah, I can do it. Give me a few minutes. |
Thanks a lot! |
I found some cases triggered by a |
Also, there are a lot of cases for |
Have fun, @Rangi42. :) |
My biggest fear is excessive One source of excessive asserts as exemplified by this PR is 0 and 1-index checks (and sets, i.e. Do we really want this? Personally, I'd argue no. Most instances of this are trivial enums that won't be reordered (e.g. WILD_/TRAINER_BATTLE), or instances where the 0 value has a special meaning (e.g. LINK_NULL). I'd really restrict enum-related asserts to enums that are more than a handful of values, likely to warrant reordering, and skip asserts for 0 where 0 is the "nothing" value. For anything else, comments would suffice. |
Years ago we considered macros like |
I'd be very against a In particular, this is a lot of |
Exactly, I think the asserts are cluttery due to this. |
I can delete those asserts without problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am all for asserts, but not for every little thing. I think most of these that are left are fine. Basically we want to leave it to instances where people are likely to change, and likely to miss something when doing so.
So, what's your verdict? @Rangi42 @vulcandth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked it over.. Looks fine to me. I'll give a chance for other's to add final comments and then i'll merge if nobody objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* Add assert for FACING_GRASS_1 and FACING_GRASS_2 * Add more assert cases * Add assert for HP bar colors * Assert LINK_NULL == 0 * Fix assert syntax * Add asserts for WILD_BATTLE == 1 * Add additional WILD assert - I need to sleep more... * Revert asserts for WILD_BATTLE and LINK_NULL * Commit suggested changes * Add more assert cases * Fix syntax error
No description provided.