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
c7dd0a56
Commit
c7dd0a56
authored
Jul 12, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use p_snprintf also in tests
parent
c983604e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
tests/clar_libgit2.h
+2
-1
tests/refs/pack.c
+2
-2
tests/stress/diff.c
+5
-5
tests/threads/refdb.c
+4
-4
No files found.
tests/clar_libgit2.h
View file @
c7dd0a56
...
...
@@ -3,6 +3,7 @@
#include "clar.h"
#include <git2.h>
#include <posix.h>
#include "common.h"
/**
...
...
@@ -51,7 +52,7 @@ GIT_INLINE(void) clar__assert_in_range(
{
if
(
lo
>
val
||
hi
<
val
)
{
char
buf
[
128
];
snprintf
(
buf
,
sizeof
(
buf
),
"%d not in [%d,%d]"
,
val
,
lo
,
hi
);
p_
snprintf
(
buf
,
sizeof
(
buf
),
"%d not in [%d,%d]"
,
val
,
lo
,
hi
);
clar__fail
(
file
,
line
,
err
,
buf
,
should_abort
);
}
}
...
...
tests/refs/pack.c
View file @
c7dd0a56
...
...
@@ -91,12 +91,12 @@ void test_refs_pack__symbolic(void)
/* make a bunch of references */
for
(
i
=
0
;
i
<
100
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
name
,
"refs/heads/master"
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
tests/stress/diff.c
View file @
c7dd0a56
...
...
@@ -97,14 +97,14 @@ void test_stress_diff__rename_big_files(void)
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
for
(
i
=
0
;
i
<
100
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
for
(
j
=
i
*
256
;
j
>
0
;
--
j
)
git_buf_printf
(
&
b
,
"more content %d
\n
"
,
i
);
cl_git_mkfile
(
tmp
,
b
.
ptr
);
}
for
(
i
=
0
;
i
<
100
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
cl_git_pass
(
git_index_add_bypath
(
index
,
tmp
+
strlen
(
"renames/"
)));
}
...
...
@@ -128,15 +128,15 @@ void test_stress_diff__rename_many_files(void)
git_buf_printf
(
&
b
,
"%08d
\n
"
ANOTHER_POEM
"%08d
\n
"
ANOTHER_POEM
ANOTHER_POEM
,
0
,
0
);
for
(
i
=
0
;
i
<
2500
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
snprintf
(
b
.
ptr
,
9
,
"%08d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
b
.
ptr
,
9
,
"%08d"
,
i
);
b
.
ptr
[
8
]
=
'\n'
;
cl_git_mkfile
(
tmp
,
b
.
ptr
);
}
git_buf_free
(
&
b
);
for
(
i
=
0
;
i
<
2500
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
cl_git_pass
(
git_index_add_bypath
(
index
,
tmp
+
strlen
(
"renames/"
)));
}
...
...
tests/threads/refdb.c
View file @
c7dd0a56
...
...
@@ -58,7 +58,7 @@ void test_threads_refdb__iterator(void)
/* make a bunch of references */
for
(
r
=
0
;
r
<
200
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
@@ -102,7 +102,7 @@ static void *create_refs(void *arg)
cl_git_pass
(
git_reference_name_to_id
(
&
head
,
g_repo
,
"HEAD"
));
for
(
i
=
0
;
i
<
10
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
[
i
],
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
if
(
i
==
5
)
{
...
...
@@ -127,7 +127,7 @@ static void *delete_refs(void *arg)
char
name
[
128
];
for
(
i
=
0
;
i
<
10
;
++
i
)
{
snprintf
(
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
(
*
id
)
&
~
0x3
,
i
);
if
(
!
git_reference_lookup
(
&
ref
,
g_repo
,
name
))
{
...
...
@@ -167,7 +167,7 @@ void test_threads_refdb__edit_while_iterate(void)
/* make a bunch of references */
for
(
r
=
0
;
r
<
50
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
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