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
0ad5c845
Commit
0ad5c845
authored
Jan 18, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
structinit test: show which byte differs
parent
1d67e8fd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
tests/structinit/structinit.c
+20
-5
No files found.
tests/structinit/structinit.c
View file @
0ad5c845
...
@@ -25,11 +25,8 @@ do { \
...
@@ -25,11 +25,8 @@ do { \
structname structname##_func_latest; \
structname structname##_func_latest; \
int structname##_curr_ver = structver - 1; \
int structname##_curr_ver = structver - 1; \
cl_git_pass(funcinitname(&structname##_func_latest, structver)); \
cl_git_pass(funcinitname(&structname##_func_latest, structver)); \
cl_check_( \
options_cmp(&structname##_macro_latest, &structname##_func_latest, \
memcmp(&structname##_macro_latest, &structname##_func_latest, \
sizeof(structname), STRINGIFY(structname)); \
sizeof(structname)) == 0, \
"Macro-based and function-based initializer for " STRINGIFY(structname) \
" are not equivalent."); \
\
\
while (structname##_curr_ver > 0) \
while (structname##_curr_ver > 0) \
{ \
{ \
...
@@ -39,6 +36,24 @@ do { \
...
@@ -39,6 +36,24 @@ do { \
}\
}\
} while(0)
} while(0)
static
void
options_cmp
(
void
*
one
,
void
*
two
,
size_t
size
,
const
char
*
name
)
{
size_t
i
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
if
(((
char
*
)
one
)[
i
]
!=
((
char
*
)
two
)[
i
])
{
char
desc
[
1024
];
p_snprintf
(
desc
,
1024
,
"Difference in %s at byte %d: macro=%u / func=%u"
,
name
,
i
,
((
char
*
)
one
)[
i
],
((
char
*
)
two
)[
i
]);
clar__fail
(
__FILE__
,
__LINE__
,
"Difference between macro and function options initializer"
,
desc
,
0
);
return
;
}
}
}
void
test_structinit_structinit__compare
(
void
)
void
test_structinit_structinit__compare
(
void
)
{
{
/* blame */
/* blame */
...
...
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