Prevent Additional Error Count Increment in UNIT_TEST_END
#31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR aims to prevent the
UNIT_TEST_END
macro from callingERROR
, which caused an unintended increment of the error count when a unit test failed.Additionally, this PR updates the message format displayed at the end of the unit test to match the format used at the start of the test for consistency.
Problem
The current
UNIT_TEST_END
macro callsERROR
macro to display an error message when a unit test fails. However,the
ERROR
macro increments thesvut_error
counter. As a result, if a unit test hasn
assertion errors, it will displayn+1
errors.For example, if the
ASSERT
statement atexample/ffd_testbench.sv:99
is made false, it will displayinstead of one due to the additional error increment caused by this issue.
Change
FAILURE
macro, which prints a red message with aFAILURE:
prefix and does not increment the error counter.FAILURE
macro instead ofERROR
.UNIT_TEST_END
to match the format used inUNIT_TEST()
.svut
to match the updated error counter checks.Result
The following picture shows the result after applying the changes. It displays the error count correctly, avoiding the extra increment.
Discussion
svut_error
count should only count the number of false assertions, but I'm not sure if this aligns with the original design intention.FAILURE
is the best approach. I decided to implement this to match the calling of theSUCCESS()
macro when a unit test pass.Please feel free to provide any feedback or alternative suggestions regarding this PR without any hesitation.
Best Regards