Commit 9d76b934 by Lambert CLARA

Fix wrong test in t04-commit

Replace all must_pass(strcmp()) by must_be_true(strcmp()==0)
parent 31bf5f38
...@@ -204,7 +204,7 @@ BEGIN_TEST(oid11, "compare formated oids") ...@@ -204,7 +204,7 @@ BEGIN_TEST(oid11, "compare formated oids")
/* Format produced the right result */ /* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0'; out[GIT_OID_HEXSZ] = '\0';
must_pass(strcmp(exp, out)); must_be_true(strcmp(exp, out) == 0);
END_TEST END_TEST
BEGIN_TEST(oid12, "compare oids (allocate + format)") BEGIN_TEST(oid12, "compare oids (allocate + format)")
...@@ -216,7 +216,7 @@ BEGIN_TEST(oid12, "compare oids (allocate + format)") ...@@ -216,7 +216,7 @@ BEGIN_TEST(oid12, "compare oids (allocate + format)")
out = git_oid_allocfmt(&in); out = git_oid_allocfmt(&in);
must_be_true(out); must_be_true(out);
must_pass(strcmp(exp, out)); must_be_true(strcmp(exp, out) == 0);
free(out); free(out);
END_TEST END_TEST
...@@ -235,7 +235,7 @@ BEGIN_TEST(oid13, "compare oids (path format)") ...@@ -235,7 +235,7 @@ BEGIN_TEST(oid13, "compare oids (path format)")
/* Format produced the right result */ /* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0'; out[GIT_OID_HEXSZ + 1] = '\0';
must_pass(strcmp(exp2, out)); must_be_true(strcmp(exp2, out) == 0);
END_TEST END_TEST
BEGIN_TEST(oid14, "convert raw oid to string") BEGIN_TEST(oid14, "convert raw oid to string")
...@@ -279,7 +279,7 @@ 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 */ /* returns out as hex formatted c-string */
str = git_oid_to_string(out, sizeof(out), &in); str = git_oid_to_string(out, sizeof(out), &in);
must_be_true(str && str == out && *(str+GIT_OID_HEXSZ) == '\0'); 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 END_TEST
BEGIN_TEST(oid15, "convert raw oid to string (big)") BEGIN_TEST(oid15, "convert raw oid to string (big)")
...@@ -299,7 +299,7 @@ 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 */ /* returns big as hex formatted c-string */
str = git_oid_to_string(big, sizeof(big), &in); str = git_oid_to_string(big, sizeof(big), &in);
must_be_true(str && str == big && *(str+GIT_OID_HEXSZ) == '\0'); 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 */ /* check tail material is untouched */
must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X'); must_be_true(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
......
...@@ -461,8 +461,8 @@ static int try_build_signature(const char *name, const char *email, git_time_t t ...@@ -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") BEGIN_TEST(signature0, "creating a signature trims leading and trailing spaces")
git_signature *sign; git_signature *sign;
must_pass(git_signature_new(&sign, " nulltoken ", " emeric.fermas@gmail.com ", 1234567890, 60)); must_pass(git_signature_new(&sign, " nulltoken ", " emeric.fermas@gmail.com ", 1234567890, 60));
must_pass(strcmp(sign->name, "nulltoken")); must_be_true(strcmp(sign->name, "nulltoken") == 0);
must_pass(strcmp(sign->email, "emeric.fermas@gmail.com")); must_be_true(strcmp(sign->email, "emeric.fermas@gmail.com") == 0);
git_signature_free((git_signature *)sign); git_signature_free((git_signature *)sign);
END_TEST END_TEST
...@@ -478,16 +478,16 @@ END_TEST ...@@ -478,16 +478,16 @@ END_TEST
BEGIN_TEST(signature2, "creating a one character signature") BEGIN_TEST(signature2, "creating a one character signature")
git_signature *sign; git_signature *sign;
must_pass(git_signature_new(&sign, "x", "foo@bar.baz", 1234567890, 60)); must_pass(git_signature_new(&sign, "x", "foo@bar.baz", 1234567890, 60));
must_pass(strcmp(sign->name, "x")); must_be_true(strcmp(sign->name, "x") == 0);
must_pass(strcmp(sign->email, "foo@bar.baz")); must_be_true(strcmp(sign->email, "foo@bar.baz") == 0);
git_signature_free((git_signature *)sign); git_signature_free((git_signature *)sign);
END_TEST END_TEST
BEGIN_TEST(signature3, "creating a two character signature") BEGIN_TEST(signature3, "creating a two character signature")
git_signature *sign; git_signature *sign;
must_pass(git_signature_new(&sign, "xx", "x@y.z", 1234567890, 60)); must_pass(git_signature_new(&sign, "xx", "x@y.z", 1234567890, 60));
must_pass(strcmp(sign->name, "x")); must_be_true(strcmp(sign->name, "xx") == 0);
must_pass(strcmp(sign->email, "foo@bar.baz")); must_be_true(strcmp(sign->email, "x@y.z") == 0);
git_signature_free((git_signature *)sign); git_signature_free((git_signature *)sign);
END_TEST END_TEST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment