ctest icon indicating copy to clipboard operation
ctest copied to clipboard

Added string compare test utility

Open g1n93r opened this issue 5 years ago • 2 comments

I added string compare test utility ASSERT_STRSTR and ASSERT_NOT_STRSTR. I found it really usefull for testing json string output.

Enjoy!

g1n93r avatar Mar 31 '21 17:03 g1n93r

There are some issues i see:

  • cointain -> contain
  • why do you check the combinations of hackstack + needle, where one can be NULL? Why not force both of them to be non-NULL?

bvdberg avatar Apr 01 '21 07:04 bvdberg

There are some issues i see:

  • cointain -> contain
  • why do you check the combinations of hackstack + needle, where one can be NULL? Why not force both of them to be non-NULL?

You are right! I fixed it so : ASSERT_NOT_STRSTR(NULL, ""); => PASS ASSERT_NOT_STRSTR("", NULL); => PASS ASSERT_NOT_STRSTR(NULL, NULL); => PASS ASSERT_STRSTR(NULL, ""); => FAIL ASSERT_STRSTR("", NULL); => FAIL ASSERT_STRSTR(NULL, NULL); => FAIL Both ASSERT_NOT_STRSTR(NULL, NULL) and ASSERT_STRSTR(NULL, NULL) are bit ambiguous as one could argue that NULL does contain NULL. Would you make a special case for those?

g1n93r avatar Apr 01 '21 18:04 g1n93r