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
7df41387
Commit
7df41387
authored
Nov 29, 2011
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding unit tests for git_buf_copy_cstr
parent
c63728cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
tests-clay/core/buffer.c
+22
-0
No files found.
tests-clay/core/buffer.c
View file @
7df41387
...
@@ -52,6 +52,7 @@ void test_core_buffer__2(void)
...
@@ -52,6 +52,7 @@ void test_core_buffer__2(void)
{
{
git_buf
buf
=
GIT_BUF_INIT
;
git_buf
buf
=
GIT_BUF_INIT
;
int
i
;
int
i
;
char
data
[
100
];
cl_assert
(
buf
.
size
==
0
);
cl_assert
(
buf
.
size
==
0
);
...
@@ -129,6 +130,27 @@ void test_core_buffer__2(void)
...
@@ -129,6 +130,27 @@ void test_core_buffer__2(void)
cl_assert_strequal
(
""
,
git_buf_cstr
(
&
buf
));
cl_assert_strequal
(
""
,
git_buf_cstr
(
&
buf
));
git_buf_free
(
&
buf
);
git_buf_free
(
&
buf
);
/* test extracting data into buffer */
git_buf_puts
(
&
buf
,
REP4
(
"0123456789"
));
cl_assert
(
git_buf_oom
(
&
buf
)
==
0
);
git_buf_copy_cstr
(
data
,
100
,
&
buf
);
cl_assert_strequal
(
data
,
REP4
(
"0123456789"
));
git_buf_copy_cstr
(
data
,
11
,
&
buf
);
cl_assert_strequal
(
data
,
"0123456789"
);
git_buf_copy_cstr
(
data
,
3
,
&
buf
);
cl_assert_strequal
(
data
,
"01"
);
git_buf_copy_cstr
(
data
,
1
,
&
buf
);
cl_assert_strequal
(
data
,
""
);
git_buf_copy_cstr
(
data
,
100
,
&
buf
);
cl_assert_strequal
(
data
,
REP4
(
"0123456789"
));
git_buf_free
(
&
buf
);
git_buf_copy_cstr
(
data
,
100
,
&
buf
);
cl_assert_strequal
(
data
,
""
);
}
}
/* let's do some tests with larger buffers to push our limits */
/* let's do some tests with larger buffers to push our limits */
...
...
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