Added MU_RUN_TEST_PARAMETERIZED and refactored code#39
Open
Ledmington wants to merge 1 commit intosiu:masterfrom
Open
Added MU_RUN_TEST_PARAMETERIZED and refactored code#39Ledmington wants to merge 1 commit intosiu:masterfrom
Ledmington wants to merge 1 commit intosiu:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I added the function MU_RUN_TEST_PARAMETERIZED that allows to define an array of values of the same type and a test. This test is run each time with a new value taken from the array. This should simplify some testing scenarios performing some kind of grid search.
Since the MU_RUN_TEST and MU_RUN_TEST_PARAMETERIZED function are very similar (the same function for now, but the latter could implement a more specific error message like "the test T failed when the value was X"), i refactored the code extracting the MU_SETUP_TIMER and MU_CHECK_AND_FAIL macros.
For now i only implemented the simple parameterized runner iterating over only 1 parameter array, but from here is trivial to add more arrays to iterate. (i can implement them myself, if needed)
Here is an example of usage of this function:
Note: for now i didn't find a better way to pass the values to the test function than to use global variables.