Skip to content

Conversation

@Xeom
Copy link
Contributor

@Xeom Xeom commented Nov 4, 2024

Tests such as asserts were implemented as macros containing two parts:

    snow_fail_update(); // Update the globally stored file and line number
    _asserteq(thing 1, thing 2); // Perform a check

This falls down if "thing 1" or "thing 2" contain assertions themselves, which themselves update the globally stored file and line number. If the outer assertion then fails, it reports the wrong file and line number.

To fix this, add a struct _snow_explanation that is created in assertion macros, and is used to update the global file and line number only once the actual failure is triggered.

Tests such as asserts were implemented as macros containing two parts:

    snow_fail_update(); // Update the globally stored file and line number
    _asserteq(thing 1, thing 2); // Perform a check

This falls down if "thing 1" or "thing 2" contain assertions themselves,
which themselves update the globally stored file and line number. If the
outer assertion then fails, it reports the wrong file and line number.

To fix this, add a struct _snow_explanation that is created in assertion
macros, and is used to update the global file and line number only once
the actual failiure is triggered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant