Commit 9c7f8ce7 authored by Oleg Efimov's avatar Oleg Efimov Committed by Robert Edmonds

t/: add test case for Issue #129 from Oleg Efimov

parent d2658e25
......@@ -1406,6 +1406,27 @@ test_optional_default_values (void)
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
test_field_merge (void)
{
......@@ -1672,6 +1693,8 @@ static Test tests[] =
{ "test required default values", test_required_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 free unpacked", test_alloc_free_all },
......
......@@ -207,6 +207,13 @@ message DefaultOptionalValues {
optional string v_string = 7 [default = "hi mom\n"];
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 {
optional bytes o_bytes = 1;
repeated string r_string = 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment