Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
protobuf-c
Commits
9c7f8ce7
Commit
9c7f8ce7
authored
Mar 22, 2014
by
Oleg Efimov
Committed by
Robert Edmonds
Mar 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
t/: add test case for Issue #129 from Oleg Efimov
parent
d2658e25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
t/generated-code2/test-generated-code2.c
t/generated-code2/test-generated-code2.c
+23
-0
t/test-full.proto
t/test-full.proto
+7
-0
No files found.
t/generated-code2/test-generated-code2.c
View file @
9c7f8ce7
...
@@ -1406,6 +1406,27 @@ test_optional_default_values (void)
...
@@ -1406,6 +1406,27 @@ test_optional_default_values (void)
foo__default_optional_values__free_unpacked
(
mess2
,
NULL
);
foo__default_optional_values__free_unpacked
(
mess2
,
NULL
);
}
}
static
void
assert_optional_lowercase_enum_default_value_is_default
(
Foo__LowerCase
*
mess
)
{
assert
(
!
mess
->
has_value
);
assert
(
mess
->
value
==
2
);
}
static
void
test_optional_lowercase_enum_default_value
(
void
)
{
Foo__LowerCase
mess
=
FOO__LOWER_CASE__INIT
;
Foo__LowerCase
*
mess2
;
size_t
len
;
uint8_t
*
data
;
assert_optional_lowercase_enum_default_value_is_default
(
&
mess
);
mess2
=
test_compare_pack_methods
(
&
mess
.
base
,
&
len
,
&
data
);
assert
(
len
==
0
);
/* no non-default values */
free
(
data
);
assert_optional_lowercase_enum_default_value_is_default
(
mess2
);
foo__lower_case__free_unpacked
(
mess2
,
NULL
);
}
static
void
static
void
test_field_merge
(
void
)
test_field_merge
(
void
)
{
{
...
@@ -1672,6 +1693,8 @@ static Test tests[] =
...
@@ -1672,6 +1693,8 @@ static Test tests[] =
{
"test required default values"
,
test_required_default_values
},
{
"test required default values"
,
test_required_default_values
},
{
"test optional default values"
,
test_optional_default_values
},
{
"test optional default values"
,
test_optional_default_values
},
{
"test optional lowercase enum default value"
,
test_optional_lowercase_enum_default_value
},
{
"test field merge"
,
test_field_merge
},
{
"test field merge"
,
test_field_merge
},
{
"test free unpacked"
,
test_alloc_free_all
},
{
"test free unpacked"
,
test_alloc_free_all
},
...
...
t/test-full.proto
View file @
9c7f8ce7
...
@@ -207,6 +207,13 @@ message DefaultOptionalValues {
...
@@ -207,6 +207,13 @@ message DefaultOptionalValues {
optional
string
v_string
=
7
[
default
=
"hi mom\n"
];
optional
string
v_string
=
7
[
default
=
"hi mom\n"
];
optional
bytes
v_bytes
=
8
[
default
=
"a \0 character"
];
optional
bytes
v_bytes
=
8
[
default
=
"a \0 character"
];
}
}
message
LowerCase
{
enum
CaseEnum
{
UPPER
=
1
;
lower
=
2
;
}
optional
CaseEnum
value
=
1
[
default
=
lower
];
}
message
AllocValues
{
message
AllocValues
{
optional
bytes
o_bytes
=
1
;
optional
bytes
o_bytes
=
1
;
repeated
string
r_string
=
2
;
repeated
string
r_string
=
2
;
...
...
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