Skip to content
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

TEST_STRING_EQUAL method #47

Closed
RedMoon32 opened this issue Apr 27, 2020 · 2 comments
Closed

TEST_STRING_EQUAL method #47

RedMoon32 opened this issue Apr 27, 2020 · 2 comments

Comments

@RedMoon32
Copy link

RedMoon32 commented Apr 27, 2020

Why there is no method for string comparison?
TEST_CHECK(strcmp(produced, expected) == 0) is not very comfortable.
I think for exampleTEST_STRING_EQUAL("123456789","123567899") which will write to output
smthn like "
String Check Failed
123456789
123567899
>>>4!=5
" will be very useful for many purposes
I can implement it

@RedMoon32 RedMoon32 changed the title TEST_STRING_CHECK method TEST_STRING_EQUAL method Apr 27, 2020
@gahr
Copy link
Contributor

gahr commented Apr 27, 2020

@mity
Copy link
Owner

mity commented Apr 27, 2020

One of the original motivations for Acutest was my dislike of baroque interfaces in existing solutions which provide a comparison macro for every combination of type and comparison operator and sometime even for some other aspect of the test (e.g. assert-like versus check-like behavior).

See e.g. https://github.com/ThrowTheSwitch/Unity/blob/ae8b98e80b716eb6c627f1c98261ffe9f9d3acca/src/unity.h#L124 for an example what I mean.

To clarify: that's not meant as an objective criticism, it's just a matter of my subjective taste.

I am willing to make some concessions where there is a wide consensus that the potential benefit outweighs the purity of the interface (and the string comparison might perhaps be that case).

But let me state clearly that I don't want to end up with the dozens of comparison macros like in the linked example.

And actually even here I am wondering whether you are proposing just the one macro, or implicitly also TEST_STRING_NOT_EQUAL, TEST_STRING_LOWER_THAN, TEST_STRING_EQUAL_OR_LOWER_THAN etc. and then ditto for case insensitive comparison and then....

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

No branches or pull requests

3 participants