Fix ahead-behind tests The logic was reversed. I have checked manually each pair with git and adjusted the expectation to what git status prints.
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
diff --git a/tests/revwalk/mergebase.c b/tests/revwalk/mergebase.c
index 2c7184f..8f1f6ef 100644
--- a/tests/revwalk/mergebase.c
+++ b/tests/revwalk/mergebase.c
@@ -33,12 +33,12 @@ void test_revwalk_mergebase__single1(void)
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
- cl_assert_equal_sz(ahead, 2);
- cl_assert_equal_sz(behind, 1);
+ cl_assert_equal_sz(ahead, 1);
+ cl_assert_equal_sz(behind, 2);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
- cl_assert_equal_sz(ahead, 1);
- cl_assert_equal_sz(behind, 2);
+ cl_assert_equal_sz(ahead, 2);
+ cl_assert_equal_sz(behind, 1);
}
void test_revwalk_mergebase__single2(void)
@@ -54,12 +54,12 @@ void test_revwalk_mergebase__single2(void)
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two));
- cl_assert_equal_sz(ahead, 4);
- cl_assert_equal_sz(behind, 1);
-
- cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &two, &one));
cl_assert_equal_sz(ahead, 1);
cl_assert_equal_sz(behind, 4);
+
+ cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &two, &one));
+ cl_assert_equal_sz(ahead, 4);
+ cl_assert_equal_sz(behind, 1);
}
void test_revwalk_mergebase__merged_branch(void)
@@ -78,12 +78,12 @@ void test_revwalk_mergebase__merged_branch(void)
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
- cl_assert_equal_sz(ahead, 0);
- cl_assert_equal_sz(behind, 3);
-
- cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
cl_assert_equal_sz(ahead, 3);
cl_assert_equal_sz(behind, 0);
+
+ cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
+ cl_assert_equal_sz(ahead, 0);
+ cl_assert_equal_sz(behind, 3);
}
void test_revwalk_mergebase__two_way_merge(void)
@@ -95,13 +95,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_equal_sz(ahead, 2);
- cl_assert_equal_sz(behind, 8);
+ cl_assert_equal_sz(ahead, 8);
+ cl_assert_equal_sz(behind, 2);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &two, &one));
- cl_assert_equal_sz(ahead, 8);
- cl_assert_equal_sz(behind, 2);
+ cl_assert_equal_sz(ahead, 2);
+ cl_assert_equal_sz(behind, 8);
}
void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
@@ -119,8 +119,8 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
cl_assert_equal_i(GIT_ENOTFOUND, error);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
- cl_assert_equal_sz(2, ahead);
- cl_assert_equal_sz(4, behind);
+ cl_assert_equal_sz(4, ahead);
+ cl_assert_equal_sz(2, behind);
}
void test_revwalk_mergebase__prefer_youngest_merge_base(void)