summaryrefslogtreecommitdiff
path: root/tests/revwalk
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2014-07-01 14:09:01 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2014-07-01 14:40:16 -0400
commit0cee70ebb7297f155129e0d05f5a23be82231256 (patch)
tree6d98f55d737f4187e58f2a180ffb75f05b98bfba /tests/revwalk
parente1fc03c9baea9864dec90d0aef7aadcc2ff20576 (diff)
downloadlibgit2-0cee70ebb7297f155129e0d05f5a23be82231256.tar.gz
Introduce cl_assert_equal_oid
Diffstat (limited to 'tests/revwalk')
-rw-r--r--tests/revwalk/hidecb.c16
-rw-r--r--tests/revwalk/mergebase.c14
2 files changed, 12 insertions, 18 deletions
diff --git a/tests/revwalk/hidecb.c b/tests/revwalk/hidecb.c
index 26ff183fa..14cf39afd 100644
--- a/tests/revwalk/hidecb.c
+++ b/tests/revwalk/hidecb.c
@@ -69,21 +69,15 @@ static int hide_commit_cb(const git_oid *commit_id, void *data)
GIT_UNUSED(commit_id);
GIT_UNUSED(data);
- if (0 == git_oid_cmp(commit_id, &commit_ids[5]))
- return 1;
- else
- return 0;
-
+ return (git_oid_cmp(commit_id, &commit_ids[5]) == 0);
}
/* In payload data, pointer to a commit id is passed */
static int hide_commit_use_payload_cb(const git_oid *commit_id, void *data)
{
git_oid *hide_commit_id = data;
- if (git_oid_cmp(commit_id, hide_commit_id) == 0)
- return 1;
- else
- return 0;
+
+ return (git_oid_cmp(commit_id, hide_commit_id) == 0);
}
void test_revwalk_hidecb__hide_all_cb(void)
@@ -170,7 +164,7 @@ void test_revwalk_hidecb__hide_some_commits(void)
i = 0;
while ((error = git_revwalk_next(&id, walk)) == 0) {
- cl_assert_equal_i(git_oid_cmp(&id, &commit_ids[i]), 0);
+ cl_assert_equal_oid(&commit_ids[i], &id);
i++;
}
@@ -194,7 +188,7 @@ void test_revwalk_hidecb__test_payload(void)
i = 0;
while ((error = git_revwalk_next(&id, walk)) == 0) {
- cl_assert_equal_i(git_oid_cmp(&id, &commit_ids[i]), 0);
+ cl_assert_equal_oid(&commit_ids[i], &id);
i++;
}
diff --git a/tests/revwalk/mergebase.c b/tests/revwalk/mergebase.c
index 97663502c..2c7184fc7 100644
--- a/tests/revwalk/mergebase.c
+++ b/tests/revwalk/mergebase.c
@@ -30,7 +30,7 @@ void test_revwalk_mergebase__single1(void)
cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
- cl_assert(git_oid_cmp(&result, &expected) == 0);
+ cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 2);
@@ -51,7 +51,7 @@ void test_revwalk_mergebase__single2(void)
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
- cl_assert(git_oid_cmp(&result, &expected) == 0);
+ cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 4);
@@ -72,10 +72,10 @@ void test_revwalk_mergebase__merged_branch(void)
cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
- cl_assert(git_oid_cmp(&result, &expected) == 0);
+ cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_merge_base(&result, _repo, &two, &one));
- cl_assert(git_oid_cmp(&result, &expected) == 0);
+ cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 0);
@@ -132,7 +132,7 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void)
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
- cl_assert(git_oid_cmp(&result, &expected) == 0);
+ cl_assert_equal_oid(&expected, &result);
}
void test_revwalk_mergebase__no_off_by_one_missing(void)
@@ -177,7 +177,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
cl_git_pass(git_merge_base_many(&oid, _repo, count, oids));
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
- cl_assert(git_oid_cmp(&expected, &oid) == 0);
+ cl_assert_equal_oid(&expected, &oid);
}
git__free(oids);
@@ -241,7 +241,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
cl_git_pass(git_merge_base_octopus(&oid, _repo, count, oids));
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
- cl_assert(git_oid_cmp(&expected, &oid) == 0);
+ cl_assert_equal_oid(&expected, &oid);
}
git__free(oids);