/* End of tests on long double macros */
{ "Simple Tests", "test_percent_n_escaped", CK_FAILURE, "Assertion 'returnsZero(\"%n\") == 1' failed: returnsZero(\"%n\") == 0, 1 == 1" },
{ "Simple Tests", "test_ck_assert_str_eq", CK_FAILURE, "Assertion '\"test1\" == s' failed: \"test1\" == \"test1\", s == \"test2\"" },
+ { "Simple Tests", "test_ck_assert_str_eq_with_null", CK_FAILURE, "Assertion 't == s' failed: t == (null), s == (null)" },
{ "Simple Tests", "test_ck_assert_str_ne", CK_FAILURE, "Assertion 't != s' failed: t == \"test2\", s == \"test2\"" },
+ { "Simple Tests", "test_ck_assert_str_ne_with_null", CK_FAILURE, "Assertion 't != s' failed: t == \"test\", s == (null)" },
{ "Simple Tests", "test_ck_assert_str_lt", CK_FAILURE, "Assertion 's < s' failed: s == \"test1\", s == \"test1\"" },
+ { "Simple Tests", "test_ck_assert_str_lt_with_null", CK_FAILURE, "Assertion 's < t' failed: s == (null), t == \"test\"" },
{ "Simple Tests", "test_ck_assert_str_le", CK_FAILURE, "Assertion 't <= s' failed: t == \"test2\", s == \"test1\"" },
+ { "Simple Tests", "test_ck_assert_str_le_with_null", CK_FAILURE, "Assertion 't <= s' failed: t == (null), s == (null)" },
{ "Simple Tests", "test_ck_assert_str_gt", CK_FAILURE, "Assertion 't > t' failed: t == \"test2\", t == \"test2\"" },
+ { "Simple Tests", "test_ck_assert_str_gt_with_null", CK_FAILURE, "Assertion 't > s' failed: t == \"test\", s == (null)" },
{ "Simple Tests", "test_ck_assert_str_ge", CK_FAILURE, "Assertion 's >= t' failed: s == \"test1\", t == \"test2\"" },
+ { "Simple Tests", "test_ck_assert_str_ge_with_null", CK_FAILURE, "Assertion 's >= t' failed: s == (null), t == (null)" },
{ "Simple Tests", "test_ck_assert_str_expr", CK_PASS, "Passed" },
{ "Simple Tests", "test_ck_assert_ptr_eq", CK_FAILURE, "Assertion 'x == y' failed: x == 0x1, y == 0x2" },
{ "Simple Tests", "test_ck_assert_ptr_ne", CK_FAILURE, "Assertion 'x != z' failed: x == 0x1, z == 0x1" },
START_TEST(test_ck_assert_str_eq)
{
- const char *s = "test2";
record_test_name(tcase_name());
+
+ const char *s = "test2";
ck_assert_str_eq("test2", s);
record_failure_line_num(__LINE__);
ck_assert_str_eq("test1", s);
}
END_TEST
+START_TEST(test_ck_assert_str_eq_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = NULL;
+ record_failure_line_num(__LINE__);
+ ck_assert_str_eq(t, s);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_ne)
{
+ record_test_name(tcase_name());
+
const char *s = "test2";
const char *t = "test1";
- record_test_name(tcase_name());
ck_assert_str_ne(t, s);
t = "test2";
record_failure_line_num(__LINE__);
}
END_TEST
+START_TEST(test_ck_assert_str_ne_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = "test";
+ record_failure_line_num(__LINE__);
+ ck_assert_str_ne(t, s);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_lt)
{
+ record_test_name(tcase_name());
+
const char *s = "test1";
const char *t = "test2";
- record_test_name(tcase_name());
ck_assert_str_lt(s, t);
record_failure_line_num(__LINE__);
ck_assert_str_lt(s, s);
}
END_TEST
+START_TEST(test_ck_assert_str_lt_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = "test";
+ record_failure_line_num(__LINE__);
+ ck_assert_str_lt(s, t);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_le)
{
+ record_test_name(tcase_name());
+
const char *s = "test1";
const char *t = "test2";
- record_test_name(tcase_name());
ck_assert_str_le(s, t);
ck_assert_str_le(s, s);
record_failure_line_num(__LINE__);
}
END_TEST
+START_TEST(test_ck_assert_str_le_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = NULL;
+ record_failure_line_num(__LINE__);
+ ck_assert_str_le(t, s);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_gt)
{
+ record_test_name(tcase_name());
+
const char *s = "test1";
const char *t = "test2";
- record_test_name(tcase_name());
ck_assert_str_gt(t, s);
record_failure_line_num(__LINE__);
ck_assert_str_gt(t, t);
}
END_TEST
+START_TEST(test_ck_assert_str_gt_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = "test";
+ record_failure_line_num(__LINE__);
+ ck_assert_str_gt(t, s);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_ge)
{
+ record_test_name(tcase_name());
+
const char *s = "test1";
const char *t = "test2";
- record_test_name(tcase_name());
ck_assert_str_ge(t, s);
ck_assert_str_ge(t, t);
record_failure_line_num(__LINE__);
}
END_TEST
+START_TEST(test_ck_assert_str_ge_with_null)
+{
+ record_test_name(tcase_name());
+
+ const char *s = NULL;
+ const char *t = NULL;
+ record_failure_line_num(__LINE__);
+ ck_assert_str_ge(s, t);
+}
+END_TEST
+
START_TEST(test_ck_assert_str_expr)
{
+ record_test_name(tcase_name());
+
const char *s = "test1";
const char *t[] = { "test1", "test2" };
- record_test_name(tcase_name());
int i = -1;
ck_assert_str_eq(s, t[++i]);
ck_assert_str_eq(s, t[i]);
tcase_add_test (tc_simple, test_ck_assert_ldouble_nan_and_inf_with_expr);
tcase_add_test (tc_simple, test_percent_n_escaped);
tcase_add_test (tc_simple, test_ck_assert_str_eq);
+ tcase_add_test (tc_simple, test_ck_assert_str_eq_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_ne);
+ tcase_add_test (tc_simple, test_ck_assert_str_ne_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_lt);
+ tcase_add_test (tc_simple, test_ck_assert_str_lt_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_le);
+ tcase_add_test (tc_simple, test_ck_assert_str_le_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_gt);
+ tcase_add_test (tc_simple, test_ck_assert_str_gt_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_ge);
+ tcase_add_test (tc_simple, test_ck_assert_str_ge_with_null);
tcase_add_test (tc_simple, test_ck_assert_str_expr);
tcase_add_test (tc_simple, test_ck_assert_ptr_eq);
tcase_add_test (tc_simple, test_ck_assert_ptr_ne);