Skip to content

Adding test matrix feature#599

Closed
AJIOB wants to merge 6 commits intoThrowTheSwitch:masterfrom
AJIOB:adding_test_matrix_feature
Closed

Adding test matrix feature#599
AJIOB wants to merge 6 commits intoThrowTheSwitch:masterfrom
AJIOB:adding_test_matrix_feature

Conversation

@AJIOB
Copy link
Contributor

@AJIOB AJIOB commented Feb 16, 2022

As an analog for TEST_CASE(...) & TEST_RANGE(...), you can use TEST_MATRIX(...) for defining custom test cases.

TEST_MATRIX macro parsing can be enabled together with TEST_RANGE.

Supports almost all found C & C++ literals & expressions (expect array addressing with [], such as my_arr[26]). Also supports multiline matrixes, ranges & cases.

Examples of some tests with that usage:

TEST_MATRIX([ "World", "More \"words", "than ]", "one)", NULL ], [ 5, 8, 4, 32 ])
TEST_MATRIX([
        NULL, "name",
        "name1", "2name", "33name"
    ], [4])
void test_nothing(const char *s, uint32_t b)
{
    TEST_ASSERT_NOT_NULL_MESSAGE(s, "Bad string");
    TEST_ASSERT_NOT_EQUAL_UINT32_MESSAGE(0, b, "Number is zero");
}

Alex Overchenko and others added 6 commits February 16, 2022 16:05
Can be helpful for iterating every combination:
* for usual TEST_CASE simplification
Based on TEST_RANGE implementation
* (DEFINED_VALUE + 1) calls will be correctly detected now
* signed numbers should be correctly detected now
* regex speed improvements
@AJIOB
Copy link
Contributor Author

AJIOB commented Feb 21, 2022

Hello @mvandervoord,

Have I lost some requirements for merging that merge?

With regards,
Alex

@mvandervoord
Copy link
Member

Hi Alex:

I'm trying to figure out a good way to test all of this. It's going to require tests to make sure the script itself performs the job assigned, as well as that both the code using the new notation and the generated code both actually perform their job and compile without error.

Also, we're going to want to make sure the documentation for the new feature gets added.

These things don't all have to be on you, necessarily, but they're important for a significant feature like this.

@jonhenneberg
Copy link

@AJIOB and @mvandervoord Was this abandoned for some other/better solution ?

I'm interested in the feature, and was considering adding something to our local fork of Unity, but would rather add it to the upstream project, so if it wasn't dropped due to some other design or an incompatibility, I was contemplating brushing this PR off, getting it updated and looking at what could be done to add tests to it.

@mvandervoord
Copy link
Member

I just haven't had time to get back on this, unfortunately. :(

@jonhenneberg
Copy link

So the idea was not abandoned, so updating it (fix the conflicts) and adding tests wouldn't be a wasted effort.

Then I might try and find the time to look at it

@mvandervoord
Copy link
Member

@jonhenneberg -- it would not be a wasted effort. In fact, it would be much appreciated. :)

@jonhenneberg jonhenneberg mentioned this pull request Jul 13, 2023
@AJIOB
Copy link
Contributor Author

AJIOB commented Aug 14, 2023

This changes were already merged while PR #685, closing the current PR

@AJIOB AJIOB closed this Aug 14, 2023
@AJIOB AJIOB deleted the adding_test_matrix_feature branch August 14, 2023 07:36
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.

3 participants