Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
7beeb3f4
Commit
7beeb3f4
authored
Feb 22, 2013
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'exp' so it doesn't conflict with exp()
parent
06eaa06f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
59 deletions
+59
-59
tests-clar/diff/tree.c
+59
-59
No files found.
tests-clar/diff/tree.c
View file @
7beeb3f4
...
...
@@ -5,13 +5,13 @@ static git_repository *g_repo = NULL;
static
git_diff_options
opts
;
static
git_diff_list
*
diff
;
static
git_tree
*
a
,
*
b
;
static
diff_expects
exp
;
static
diff_expects
exp
ect
;
void
test_diff_tree__initialize
(
void
)
{
GIT_INIT_STRUCTURE
(
&
opts
,
GIT_DIFF_OPTIONS_VERSION
);
memset
(
&
exp
,
0
,
sizeof
(
exp
));
memset
(
&
exp
ect
,
0
,
sizeof
(
expect
));
diff
=
NULL
;
a
=
NULL
;
...
...
@@ -49,41 +49,41 @@ void test_diff_tree__0(void)
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
a
,
b
,
&
opts
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
ect
));
cl_assert_equal_i
(
5
,
exp
.
files
);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
5
,
exp
ect
.
files
);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
5
,
exp
.
hunks
);
cl_assert_equal_i
(
5
,
exp
ect
.
hunks
);
cl_assert_equal_i
(
7
+
24
+
1
+
6
+
6
,
exp
.
lines
);
cl_assert_equal_i
(
1
,
exp
.
line_ctxt
);
cl_assert_equal_i
(
24
+
1
+
5
+
5
,
exp
.
line_adds
);
cl_assert_equal_i
(
7
+
1
,
exp
.
line_dels
);
cl_assert_equal_i
(
7
+
24
+
1
+
6
+
6
,
exp
ect
.
lines
);
cl_assert_equal_i
(
1
,
exp
ect
.
line_ctxt
);
cl_assert_equal_i
(
24
+
1
+
5
+
5
,
exp
ect
.
line_adds
);
cl_assert_equal_i
(
7
+
1
,
exp
ect
.
line_dels
);
git_diff_list_free
(
diff
);
diff
=
NULL
;
memset
(
&
exp
,
0
,
sizeof
(
exp
));
memset
(
&
exp
ect
,
0
,
sizeof
(
expect
));
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
c
,
b
,
&
opts
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
ect
));
cl_assert_equal_i
(
2
,
exp
.
files
);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
2
,
exp
ect
.
files
);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
2
,
exp
.
hunks
);
cl_assert_equal_i
(
2
,
exp
ect
.
hunks
);
cl_assert_equal_i
(
8
+
15
,
exp
.
lines
);
cl_assert_equal_i
(
1
,
exp
.
line_ctxt
);
cl_assert_equal_i
(
1
,
exp
.
line_adds
);
cl_assert_equal_i
(
7
+
14
,
exp
.
line_dels
);
cl_assert_equal_i
(
8
+
15
,
exp
ect
.
lines
);
cl_assert_equal_i
(
1
,
exp
ect
.
line_ctxt
);
cl_assert_equal_i
(
1
,
exp
ect
.
line_adds
);
cl_assert_equal_i
(
7
+
14
,
exp
ect
.
line_dels
);
git_tree_free
(
c
);
}
...
...
@@ -190,19 +190,19 @@ void test_diff_tree__bare(void)
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
a
,
b
,
&
opts
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
ect
));
cl_assert_equal_i
(
3
,
exp
.
files
);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
3
,
exp
ect
.
files
);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
3
,
exp
.
hunks
);
cl_assert_equal_i
(
3
,
exp
ect
.
hunks
);
cl_assert_equal_i
(
4
,
exp
.
lines
);
cl_assert_equal_i
(
0
,
exp
.
line_ctxt
);
cl_assert_equal_i
(
3
,
exp
.
line_adds
);
cl_assert_equal_i
(
1
,
exp
.
line_dels
);
cl_assert_equal_i
(
4
,
exp
ect
.
lines
);
cl_assert_equal_i
(
0
,
exp
ect
.
line_ctxt
);
cl_assert_equal_i
(
3
,
exp
ect
.
line_adds
);
cl_assert_equal_i
(
1
,
exp
ect
.
line_dels
);
}
void
test_diff_tree__merge
(
void
)
...
...
@@ -231,19 +231,19 @@ void test_diff_tree__merge(void)
git_diff_list_free
(
diff2
);
cl_git_pass
(
git_diff_foreach
(
diff1
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
diff1
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
ect
));
cl_assert_equal_i
(
6
,
exp
.
files
);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
3
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
6
,
exp
ect
.
files
);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
3
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
6
,
exp
.
hunks
);
cl_assert_equal_i
(
6
,
exp
ect
.
hunks
);
cl_assert_equal_i
(
59
,
exp
.
lines
);
cl_assert_equal_i
(
1
,
exp
.
line_ctxt
);
cl_assert_equal_i
(
36
,
exp
.
line_adds
);
cl_assert_equal_i
(
22
,
exp
.
line_dels
);
cl_assert_equal_i
(
59
,
exp
ect
.
lines
);
cl_assert_equal_i
(
1
,
exp
ect
.
line_ctxt
);
cl_assert_equal_i
(
36
,
exp
ect
.
line_adds
);
cl_assert_equal_i
(
22
,
exp
ect
.
line_dels
);
git_diff_list_free
(
diff1
);
}
...
...
@@ -334,7 +334,7 @@ void process_tree_to_tree_diffing(
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
a
,
b
,
&
opts
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
NULL
,
NULL
,
&
exp
));
diff
,
diff_file_cb
,
NULL
,
NULL
,
&
exp
ect
));
}
void
test_diff_tree__symlink_blob_mode_changed_to_regular_file
(
void
)
...
...
@@ -367,11 +367,11 @@ void test_diff_tree__symlink_blob_mode_changed_to_regular_file(void)
process_tree_to_tree_diffing
(
"7fccd7"
,
"806999"
);
cl_assert_equal_i
(
3
,
exp
.
files
);
cl_assert_equal_i
(
2
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
cl_assert_equal_i
(
3
,
exp
ect
.
files
);
cl_assert_equal_i
(
2
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
}
void
test_diff_tree__symlink_blob_mode_changed_to_regular_file_as_typechange
(
void
)
...
...
@@ -405,11 +405,11 @@ void test_diff_tree__symlink_blob_mode_changed_to_regular_file_as_typechange(voi
opts
.
flags
=
GIT_DIFF_INCLUDE_TYPECHANGE
;
process_tree_to_tree_diffing
(
"7fccd7"
,
"a8595c"
);
cl_assert_equal_i
(
2
,
exp
.
files
);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
cl_assert_equal_i
(
2
,
exp
ect
.
files
);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
}
void
test_diff_tree__regular_blob_mode_changed_to_executable_file
(
void
)
...
...
@@ -423,9 +423,9 @@ void test_diff_tree__regular_blob_mode_changed_to_executable_file(void)
process_tree_to_tree_diffing
(
"806999"
,
"a8595c"
);
cl_assert_equal_i
(
1
,
exp
.
files
);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
1
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
cl_assert_equal_i
(
1
,
exp
ect
.
files
);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_DELETED
]);
cl_assert_equal_i
(
1
,
exp
ect
.
file_status
[
GIT_DELTA_MODIFIED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_ADDED
]);
cl_assert_equal_i
(
0
,
exp
ect
.
file_status
[
GIT_DELTA_TYPECHANGE
]);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment