Commit 9d76b934f196ee36d39c3ae40e77b618156bc16a

Lambert CLARA 2011-08-04T22:49:39

Fix wrong test in t04-commit Replace all must_pass(strcmp()) by must_be_true(strcmp()==0)

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