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

Fix string compare macros #106

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions utest.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ utest_type_printer(long long unsigned int i) {

#define EXPECT_STREQ(x, y) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 != strcmp(x, y)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 != strcmp(x, y)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%s\"\n", x); \
UTEST_PRINTF(" Actual : \"%s\"\n", y); \
Expand All @@ -651,7 +651,7 @@ utest_type_printer(long long unsigned int i) {

#define EXPECT_STRNE(x, y) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 == strcmp(x, y)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 == strcmp(x, y)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%s\"\n", x); \
UTEST_PRINTF(" Actual : \"%s\"\n", y); \
Expand All @@ -663,7 +663,7 @@ utest_type_printer(long long unsigned int i) {

#define EXPECT_STRNEQ(x, y, n) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 != UTEST_STRNCMP(x, y, n)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 != UTEST_STRNCMP(x, y, n)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%.*s\"\n", UTEST_CAST(int, n), x); \
UTEST_PRINTF(" Actual : \"%.*s\"\n", UTEST_CAST(int, n), y); \
Expand All @@ -675,7 +675,7 @@ utest_type_printer(long long unsigned int i) {

#define EXPECT_STRNNE(x, y, n) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 == UTEST_STRNCMP(x, y, n)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 == UTEST_STRNCMP(x, y, n)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%.*s\"\n", UTEST_CAST(int, n), x); \
UTEST_PRINTF(" Actual : \"%.*s\"\n", UTEST_CAST(int, n), y); \
Expand Down Expand Up @@ -818,7 +818,7 @@ utest_type_printer(long long unsigned int i) {

#define ASSERT_STREQ(x, y) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 != strcmp(x, y)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 != strcmp(x, y)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%s\"\n", x); \
UTEST_PRINTF(" Actual : \"%s\"\n", y); \
Expand All @@ -831,7 +831,7 @@ utest_type_printer(long long unsigned int i) {

#define ASSERT_STRNE(x, y) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 == strcmp(x, y)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 == strcmp(x, y)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%s\"\n", x); \
UTEST_PRINTF(" Actual : \"%s\"\n", y); \
Expand All @@ -844,7 +844,7 @@ utest_type_printer(long long unsigned int i) {

#define ASSERT_STRNEQ(x, y, n) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 != UTEST_STRNCMP(x, y, n)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 != UTEST_STRNCMP(x, y, n)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%.*s\"\n", UTEST_CAST(int, n), x); \
UTEST_PRINTF(" Actual : \"%.*s\"\n", UTEST_CAST(int, n), y); \
Expand All @@ -857,7 +857,7 @@ utest_type_printer(long long unsigned int i) {

#define ASSERT_STRNNE(x, y, n) \
UTEST_SURPRESS_WARNING_BEGIN do { \
if (0 == UTEST_STRNCMP(x, y, n)) { \
if (UTEST_NULL == x || UTEST_NULL == y || 0 == UTEST_STRNCMP(x, y, n)) { \
UTEST_PRINTF("%s:%u: Failure\n", __FILE__, __LINE__); \
UTEST_PRINTF(" Expected : \"%.*s\"\n", UTEST_CAST(int, n), x); \
UTEST_PRINTF(" Actual : \"%.*s\"\n", UTEST_CAST(int, n), y); \
Expand Down