diff --git a/test/test.c b/test/test.c index 3a16985..403511d 100644 --- a/test/test.c +++ b/test/test.c @@ -66,6 +66,14 @@ ASSERT_GE(2, 1); } +TESTCASE(c, ASSERT_STREQ) { + ASSERT_STREQ("foo", "foo"); +} + +TESTCASE(c, ASSERT_STRNE) { + ASSERT_STRNE("foo", "bar"); +} + TESTCASE(c, EXPECT_TRUE) { EXPECT_TRUE(1); } @@ -99,3 +107,11 @@ EXPECT_GE(1, 1); EXPECT_GE(2, 1); } + +TESTCASE(c, EXPECT_STREQ) { + EXPECT_STREQ("foo", "foo"); +} + +TESTCASE(c, EXPECT_STRNE) { + EXPECT_STRNE("foo", "bar"); +} diff --git a/test/test.c b/test/test.c index 3a16985..403511d 100644 --- a/test/test.c +++ b/test/test.c @@ -66,6 +66,14 @@ ASSERT_GE(2, 1); } +TESTCASE(c, ASSERT_STREQ) { + ASSERT_STREQ("foo", "foo"); +} + +TESTCASE(c, ASSERT_STRNE) { + ASSERT_STRNE("foo", "bar"); +} + TESTCASE(c, EXPECT_TRUE) { EXPECT_TRUE(1); } @@ -99,3 +107,11 @@ EXPECT_GE(1, 1); EXPECT_GE(2, 1); } + +TESTCASE(c, EXPECT_STREQ) { + EXPECT_STREQ("foo", "foo"); +} + +TESTCASE(c, EXPECT_STRNE) { + EXPECT_STRNE("foo", "bar"); +} diff --git a/test/test.cpp b/test/test.cpp index 713d18a..43d291f 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -66,6 +66,14 @@ ASSERT_GE(2, 1); } +TESTCASE(c, ASSERT_STREQ) { + ASSERT_STREQ("foo", "foo"); +} + +TESTCASE(c, ASSERT_STRNE) { + ASSERT_STRNE("foo", "bar"); +} + TESTCASE(cpp, EXPECT_TRUE) { EXPECT_TRUE(1); } @@ -99,3 +107,11 @@ EXPECT_GE(1, 1); EXPECT_GE(2, 1); } + +TESTCASE(c, EXPECT_STREQ) { + EXPECT_STREQ("foo", "foo"); +} + +TESTCASE(c, EXPECT_STRNE) { + EXPECT_STRNE("foo", "bar"); +} diff --git a/test/test.c b/test/test.c index 3a16985..403511d 100644 --- a/test/test.c +++ b/test/test.c @@ -66,6 +66,14 @@ ASSERT_GE(2, 1); } +TESTCASE(c, ASSERT_STREQ) { + ASSERT_STREQ("foo", "foo"); +} + +TESTCASE(c, ASSERT_STRNE) { + ASSERT_STRNE("foo", "bar"); +} + TESTCASE(c, EXPECT_TRUE) { EXPECT_TRUE(1); } @@ -99,3 +107,11 @@ EXPECT_GE(1, 1); EXPECT_GE(2, 1); } + +TESTCASE(c, EXPECT_STREQ) { + EXPECT_STREQ("foo", "foo"); +} + +TESTCASE(c, EXPECT_STRNE) { + EXPECT_STRNE("foo", "bar"); +} diff --git a/test/test.cpp b/test/test.cpp index 713d18a..43d291f 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -66,6 +66,14 @@ ASSERT_GE(2, 1); } +TESTCASE(c, ASSERT_STREQ) { + ASSERT_STREQ("foo", "foo"); +} + +TESTCASE(c, ASSERT_STRNE) { + ASSERT_STRNE("foo", "bar"); +} + TESTCASE(cpp, EXPECT_TRUE) { EXPECT_TRUE(1); } @@ -99,3 +107,11 @@ EXPECT_GE(1, 1); EXPECT_GE(2, 1); } + +TESTCASE(c, EXPECT_STREQ) { + EXPECT_STREQ("foo", "foo"); +} + +TESTCASE(c, EXPECT_STRNE) { + EXPECT_STRNE("foo", "bar"); +} diff --git a/utest.h b/utest.h index c58b39a..7257e04 100644 --- a/utest.h +++ b/utest.h @@ -37,6 +37,7 @@ #include #include #include +#include #if defined(_MSC_VER) #pragma warning(pop) @@ -168,6 +169,20 @@ #define ASSERT_GT(x, y) UTEST_ASSERT(x, y, > ) #define ASSERT_GE(x, y) UTEST_ASSERT(x, y, >= ) +#define ASSERT_STREQ(x, y) \ + if (0 != strcmp(x, y)) { \ + printf("%s:%u: Failure\n", __FILE__, __LINE__); \ + *utest_result = 1; \ + return; \ + } + +#define ASSERT_STRNE(x, y) \ + if (0 == strcmp(x, y)) { \ + printf("%s:%u: Failure\n", __FILE__, __LINE__); \ + *utest_result = 1; \ + return; \ + } + #define UTEST_EXPECT(x, y, cond) \ if (!((x)cond(y))) { \ printf("%s:%u: Failure\n", __FILE__, __LINE__); \ @@ -193,6 +208,19 @@ #define EXPECT_GT(x, y) UTEST_EXPECT(x, y, > ) #define EXPECT_GE(x, y) UTEST_EXPECT(x, y, >= ) + +#define EXPECT_STREQ(x, y) \ + if (0 != strcmp(x, y)) { \ + printf("%s:%u: Failure\n", __FILE__, __LINE__); \ + *utest_result = 1; \ + } + +#define EXPECT_STRNE(x, y) \ + if (0 == strcmp(x, y)) { \ + printf("%s:%u: Failure\n", __FILE__, __LINE__); \ + *utest_result = 1; \ + } + #define TESTCASE(set, name) \ UTEST_EXTERN struct utest_state_s utest_state; \ static void utest_run_##set##_##name(int *utest_result); \