Commit 1a0c5a34e027620416dadc604f3702ad2e8fe5d0

Scott J. Goldman 2012-11-29T17:38:37

Fixup ahead/behind tests Fix a typo that caused a failing test, and use cl_assert_equal instead of cl_assert.

diff --git a/tests-clar/revwalk/mergebase.c b/tests-clar/revwalk/mergebase.c
index 0eb6a9b..9707d42 100644
--- a/tests-clar/revwalk/mergebase.c
+++ b/tests-clar/revwalk/mergebase.c
@@ -30,12 +30,12 @@ void test_revwalk_mergebase__single1(void)
 	cl_assert(git_oid_cmp(&result, &expected) == 0);
 
 	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
-	cl_assert(ahead == 2);
-	cl_assert(behind == 1);
+	cl_assert_equal_i(ahead, 2);
+	cl_assert_equal_i(behind, 1);
 
 	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
-	cl_assert(ahead == 1);
-	cl_assert(behind == 2);
+	cl_assert_equal_i(ahead,  1);
+	cl_assert_equal_i(behind,  2);
 }
 
 void test_revwalk_mergebase__single2(void)
@@ -51,12 +51,12 @@ void test_revwalk_mergebase__single2(void)
 	cl_assert(git_oid_cmp(&result, &expected) == 0);
 
 	cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two));
-	cl_assert(ahead == 4);
-	cl_assert(behind == 1);
+	cl_assert_equal_i(ahead,  4);
+	cl_assert_equal_i(behind,  1);
 
 	cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &two, &one));
-	cl_assert(ahead == 1);
-	cl_assert(behind == 4);
+	cl_assert_equal_i(ahead,  1);
+	cl_assert_equal_i(behind,  4);
 }
 
 void test_revwalk_mergebase__merged_branch(void)
@@ -75,12 +75,12 @@ void test_revwalk_mergebase__merged_branch(void)
 	cl_assert(git_oid_cmp(&result, &expected) == 0);
 
 	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
-	cl_assert(ahead == 0);
-	cl_assert(behind == 3);
+	cl_assert_equal_i(ahead,  0);
+	cl_assert_equal_i(behind,  3);
 
 	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
-	cl_assert(ahead == 3);
-	cl_assert(behind == 0);
+	cl_assert_equal_i(ahead,  3);
+	cl_assert_equal_i(behind,  0);
 }
 
 void test_revwalk_mergebase__two_way_merge(void)
@@ -92,8 +92,13 @@ void test_revwalk_mergebase__two_way_merge(void)
 	cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417"));
 	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &one, &two));
 
-	cl_assert(ahead == 8);
-	cl_assert(behind == 2);
+	cl_assert_equal_i(ahead,  2);
+	cl_assert_equal_i(behind,  8);
+
+	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &two, &one));
+
+	cl_assert_equal_i(ahead,  8);
+	cl_assert_equal_i(behind,  2);
 }
 
 void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)