sheredom / utest.h

🧪 single header unit testing framework for C and C++
The Unlicense
834 stars 57 forks source link

Fix string compare macros #106

Closed XUJINKAI closed 2 years ago

XUJINKAI commented 2 years ago

NULL pointer in strcmp causes Segmentation fault

sheredom commented 2 years ago

I think the fails are because you should useUTEST_NULL instead of NULL.

sheredom commented 2 years ago

Gurgh - Windows is complaining with:

warning C4130: '==' : logical operation on address of string constant

I think if you added that warning to UTEST_SURPRESS_WARNING_BEGIN here https://github.com/sheredom/utest.h/blob/master/utest.h#L506 that should be fixed.

Could you also add two tests, one for x being null, the other y being null?

sheredom commented 2 years ago

Oh actually, can you add tests, since they'd need to fail. Lemme think on that bit!

sheredom commented 2 years ago

Closing in favour of #110