Fix wrong test in t04-commit Replace all must_pass(strcmp()) by must_be_true(strcmp()==0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/tests/t01-rawobj.c b/tests/t01-rawobj.c
index d8cc63b..2552085 100644
--- a/tests/t01-rawobj.c
+++ b/tests/t01-rawobj.c
@@ -204,7 +204,7 @@ BEGIN_TEST(oid11, "compare formated oids")
/* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0';
- must_pass(strcmp(exp, out));
+ must_be_true(strcmp(exp, out) == 0);
END_TEST
BEGIN_TEST(oid12, "compare oids (allocate + format)")
@@ -216,7 +216,7 @@ BEGIN_TEST(oid12, "compare oids (allocate + format)")
out = git_oid_allocfmt(&in);
must_be_true(out);
- must_pass(strcmp(exp, out));
+ must_be_true(strcmp(exp, out) == 0);
free(out);
END_TEST
@@ -235,7 +235,7 @@ BEGIN_TEST(oid13, "compare oids (path format)")
/* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0';
- must_pass(strcmp(exp2, out));
+ must_be_true(strcmp(exp2, out) == 0);
END_TEST
BEGIN_TEST(oid14, "convert raw oid to string")
@@ -279,7 +279,7 @@ BEGIN_TEST(oid14, "convert raw oid to string")
/* returns out as hex formatted c-string */
str = git_oid_to_string(out, sizeof(out), &in);
must_be_true(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
- must_pass(strcmp(exp, out));
+ must_be_true(strcmp(exp, out) == 0);
END_TEST
BEGIN_TEST(oid15, "convert raw oid to string (big)")
@@ -299,7 +299,7 @@ BEGIN_TEST(oid15, "convert raw oid to string (big)")
/* returns big as hex formatted c-string */
str = git_oid_to_string(big, sizeof(big), &in);
must_be_true(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
- must_pass(strcmp(exp, big));
+ must_be_true(strcmp(exp, big) == 0);
/* check tail material is untouched */
must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
diff --git a/tests/t04-commit.c b/tests/t04-commit.c
index b042e15..b8a641a 100644
--- a/tests/t04-commit.c
+++ b/tests/t04-commit.c
@@ -461,8 +461,8 @@ static int try_build_signature(const char *name, const char *email, git_time_t t
BEGIN_TEST(signature0, "creating a signature trims leading and trailing spaces")
git_signature *sign;
must_pass(git_signature_new(&sign, " nulltoken ", " emeric.fermas@gmail.com ", 1234567890, 60));
- must_pass(strcmp(sign->name, "nulltoken"));
- must_pass(strcmp(sign->email, "emeric.fermas@gmail.com"));
+ must_be_true(strcmp(sign->name, "nulltoken") == 0);
+ must_be_true(strcmp(sign->email, "emeric.fermas@gmail.com") == 0);
git_signature_free((git_signature *)sign);
END_TEST
@@ -478,16 +478,16 @@ END_TEST
BEGIN_TEST(signature2, "creating a one character signature")
git_signature *sign;
must_pass(git_signature_new(&sign, "x", "foo@bar.baz", 1234567890, 60));
- must_pass(strcmp(sign->name, "x"));
- must_pass(strcmp(sign->email, "foo@bar.baz"));
+ must_be_true(strcmp(sign->name, "x") == 0);
+ must_be_true(strcmp(sign->email, "foo@bar.baz") == 0);
git_signature_free((git_signature *)sign);
END_TEST
BEGIN_TEST(signature3, "creating a two character signature")
git_signature *sign;
must_pass(git_signature_new(&sign, "xx", "x@y.z", 1234567890, 60));
- must_pass(strcmp(sign->name, "x"));
- must_pass(strcmp(sign->email, "foo@bar.baz"));
+ must_be_true(strcmp(sign->name, "xx") == 0);
+ must_be_true(strcmp(sign->email, "x@y.z") == 0);
git_signature_free((git_signature *)sign);
END_TEST