Home
last modified time | relevance | path

Searched refs:msg (Results 1 – 25 of 62) sorted by relevance

123

/nanopb-2.7.6/tests/regression/issue_322/
Ddefaults.c5 int check_defaults(const DefaultsMsg *msg) in check_defaults() argument
9 TEST(msg->b1[0] == 0xDE && msg->b1[1] == 0xAD && msg->b1[2] == 0x00 && in check_defaults()
10 msg->b1[3] == 0xBE && msg->b1[4] == 0xEF); in check_defaults()
11 TEST(msg->b2.bytes[0] == 0xDE && msg->b2.bytes[1] == 0xAD && in check_defaults()
12 msg->b2.bytes[2] == 0x00 && msg->b2.bytes[3] == 0xBE && in check_defaults()
13 msg->b2.bytes[4] == 0xEF && msg->b2.size == 5); in check_defaults()
14 TEST(msg->b3.bytes[0] == 0xDE && msg->b3.bytes[1] == 0xAD && in check_defaults()
15 msg->b3.bytes[2] == 0x00 && msg->b3.bytes[3] == 0xBE && in check_defaults()
16 msg->b3.bytes[4] == 0xEF && msg->b2.size == 5); in check_defaults()
17 TEST(msg->s1[0] == (char)0xC3 && msg->s1[1] == (char)0xA4 && in check_defaults()
[all …]
/nanopb-2.7.6/tests/mem_release/
Dmem_release.c19 static void fill_TestMessage(TestMessage *msg) in fill_TestMessage() argument
21 msg->static_req_submsg.dynamic_str = "12345"; in fill_TestMessage()
22 msg->static_req_submsg.dynamic_str_arr_count = 3; in fill_TestMessage()
23 msg->static_req_submsg.dynamic_str_arr = test_str_arr; in fill_TestMessage()
24 msg->static_req_submsg.dynamic_submsg_count = 2; in fill_TestMessage()
25 msg->static_req_submsg.dynamic_submsg = test_msg_arr; in fill_TestMessage()
26 msg->static_req_submsg.dynamic_submsg[1].dynamic_str = "abc"; in fill_TestMessage()
27 msg->static_opt_submsg.dynamic_str = "abc"; in fill_TestMessage()
28 msg->static_rep_submsg_count = 2; in fill_TestMessage()
29 msg->static_rep_submsg[1].dynamic_str = "abc"; in fill_TestMessage()
[all …]
/nanopb-2.7.6/tests/sort_by_tag/
Dsort_by_tag.c14 Unsorted msg = Unsorted_init_zero; in main() local
17 TEST(&msg.first < &msg.oneof.second); in main()
18 TEST(&msg.oneof.second < &msg.last); in main()
20 msg.first = 101; in main()
21 msg.which_oneof = Unsorted_second_tag; in main()
22 msg.oneof.second = 102; in main()
23 msg.last = 103; in main()
25 if (!pb_encode(&ostream, Unsorted_fields, &msg)) in main()
36 Sorted msg = Sorted_init_zero; in main() local
39 if (!pb_decode(&istream, Sorted_fields, &msg)) in main()
[all …]
/nanopb-2.7.6/tests/proto3_optional/
Doptional.c15 TestMessage msg = TestMessage_init_zero; in main() local
17 msg.has_opt_int = true; in main()
18 msg.opt_int = 99; in main()
19 msg.normal_int = 100; in main()
20 msg.opt_int2 = 101; in main()
22 TEST(pb_encode(&stream, TestMessage_fields, &msg)); in main()
29 TestMessage msg = TestMessage_init_zero; in main() local
33 msg.opt_int2 = 5; in main()
34 msg.normal_int2 = 6; in main()
36 TEST(pb_decode_noinit(&stream, TestMessage_fields, &msg)); in main()
[all …]
/nanopb-2.7.6/tests/oneof/
Ddecode_oneof.c14 OneOfMessage msg; in test_oneof_1() local
18 memset(&msg, 0xAA, sizeof(msg)); in test_oneof_1()
20 if (!pb_decode(stream, OneOfMessage_fields, &msg)) in test_oneof_1()
27 TEST(msg.prefix == 123); in test_oneof_1()
28 TEST(msg.suffix == 321); in test_oneof_1()
33 TEST(msg.which_values == OneOfMessage_first_tag); in test_oneof_1()
34 TEST(msg.values.first == 999); in test_oneof_1()
38 TEST(msg.which_values == OneOfMessage_second_tag); in test_oneof_1()
39 TEST(strcmp(msg.values.second, "abcd") == 0); in test_oneof_1()
43 TEST(msg.which_values == OneOfMessage_third_tag); in test_oneof_1()
[all …]
Dencode_oneof.c12 OneOfMessage msg = OneOfMessage_init_zero; in main() local
25 msg.prefix = 123; in main()
30 msg.which_values = OneOfMessage_first_tag; in main()
31 msg.values.first = 999; in main()
35 msg.which_values = OneOfMessage_second_tag; in main()
36 strcpy(msg.values.second, "abcd"); in main()
40 msg.which_values = OneOfMessage_third_tag; in main()
41 msg.values.third.array_count = 5; in main()
42 msg.values.third.array[0] = 1; in main()
43 msg.values.third.array[1] = 2; in main()
[all …]
/nanopb-2.7.6/tests/common_unittests/
Dcommon_unittests.c14 AllTypes msg; in main() local
19 TEST(pb_field_iter_begin(&iter, AllTypes_fields, &msg)) in main()
21 TEST(iter.tag == 1 && iter.pData == &msg.req_int32 && !iter.pSize) in main()
22 …TEST(pb_field_iter_next(&iter) && iter.tag == 2 && iter.pData == &msg.req_int64 && !iter.pSize) in main()
23 …TEST(pb_field_iter_next(&iter) && iter.tag == 3 && iter.pData == &msg.req_uint32 && !iter.pSize) in main()
24 …TEST(pb_field_iter_next(&iter) && iter.tag == 4 && iter.pData == &msg.req_uint64 && !iter.pSize) in main()
25 …TEST(pb_field_iter_next(&iter) && iter.tag == 5 && iter.pData == &msg.req_sint32 && !iter.pSize) in main()
26 …TEST(pb_field_iter_next(&iter) && iter.tag == 6 && iter.pData == &msg.req_sint64 && !iter.pSize) in main()
27 …TEST(pb_field_iter_next(&iter) && iter.tag == 7 && iter.pData == &msg.req_bool && !iter.pSize) in main()
28 …TEST(pb_field_iter_next(&iter) && iter.tag == 8 && iter.pData == &msg.req_fixed32 && !iter.pSize) in main()
[all …]
/nanopb-2.7.6/tests/map/
Dencode_map.c12 MyMessage msg = MyMessage_init_zero; in main() local
16 msg.numbers_count = 3; in main()
17 strncpy(msg.numbers[0].key, "one", sizeof(msg.numbers[0].key)); in main()
18 strncpy(msg.numbers[1].key, "two", sizeof(msg.numbers[1].key)); in main()
19 strncpy(msg.numbers[2].key, "seven", sizeof(msg.numbers[2].key)); in main()
20 msg.numbers[0].value = 1; in main()
21 msg.numbers[1].value = 2; in main()
22 msg.numbers[2].value = 7; in main()
26 if (pb_encode(&stream, MyMessage_fields, &msg)) in main()
Ddecode_map.c13 MyMessage_NumbersEntry *find_entry(MyMessage *msg, const char *key) in find_entry() argument
16 for (i = 0; i < msg->numbers_count; i++) in find_entry()
18 if (strcmp(msg->numbers[i].key, key) == 0) in find_entry()
20 return &msg->numbers[i]; in find_entry()
42 MyMessage msg = MyMessage_init_zero; in main() local
46 if (!pb_decode(&stream, MyMessage_fields, &msg)) in main()
52 TEST((e = find_entry(&msg, "one")) && e->value == 1); in main()
53 TEST((e = find_entry(&msg, "two")) && e->value == 2); in main()
54 TEST((e = find_entry(&msg, "seven")) && e->value == 7); in main()
55 TEST(!find_entry(&msg, "zero")); in main()
/nanopb-2.7.6/tests/anonymous_oneof/
Ddecode_oneof.c14 AnonymousOneOfMessage msg; in test_oneof_1() local
18 memset(&msg, 0xAA, sizeof(msg)); in test_oneof_1()
20 if (!pb_decode(stream, AnonymousOneOfMessage_fields, &msg)) in test_oneof_1()
27 TEST(msg.prefix == 123); in test_oneof_1()
28 TEST(msg.suffix == 321); in test_oneof_1()
33 TEST(msg.which_values == AnonymousOneOfMessage_first_tag); in test_oneof_1()
34 TEST(msg.first == 999); in test_oneof_1()
38 TEST(msg.which_values == AnonymousOneOfMessage_second_tag); in test_oneof_1()
39 TEST(strcmp(msg.second, "abcd") == 0); in test_oneof_1()
43 TEST(msg.which_values == AnonymousOneOfMessage_third_tag); in test_oneof_1()
[all …]
/nanopb-2.7.6/tests/regression/issue_229/
Dmultiple_oneof.c14 MainMessage msg = MainMessage_init_zero; in main() local
15 msg.which_oneof1 = MainMessage_oneof1_uint32_tag; in main()
16 msg.oneof1.oneof1_uint32 = 1234; in main()
17 msg.which_oneof2 = MainMessage_oneof2_uint32_tag; in main()
18 msg.oneof2.oneof2_uint32 = 5678; in main()
19 TEST(pb_encode(&stream, MainMessage_fields, &msg)); in main()
25 MainMessage msg = MainMessage_init_zero; in main() local
26 TEST(pb_decode(&stream, MainMessage_fields, &msg)); in main()
27 TEST(msg.which_oneof1 == MainMessage_oneof1_uint32_tag); in main()
28 TEST(msg.oneof1.oneof1_uint32 == 1234); in main()
[all …]
/nanopb-2.7.6/tests/regression/issue_558/
Dmixed.c15 MixedMessage msg = MixedMessage_init_default; in main() local
17 msg.has_proto2_value = true; in main()
18 msg.proto2_value = 0; in main()
19 msg.proto3_value = 0; in main()
21 if (!pb_encode(&ostream, MixedMessage_fields, &msg)) in main()
33 MixedMessage msg = MixedMessage_init_default; in main() local
35 TEST(msg.proto2_value == 100); in main()
36 TEST(msg.proto3_value == 200); in main()
38 if (!pb_decode(&istream, MixedMessage_fields, &msg)) in main()
44 TEST(msg.proto2_value == 0); in main()
[all …]
/nanopb-2.7.6/tests/oneof_callback/
Ddecode_oneof.c92 SubMsg1 *msg = field->pData; in msg_callback() local
94 msg->array.funcs.decode = print_int32; in msg_callback()
95 msg->array.arg = " array: %d\n"; in msg_callback()
99 SubMsg2 *msg = field->pData; in msg_callback() local
101 msg->strvalue.funcs.decode = print_string; in msg_callback()
102 msg->strvalue.arg = " strvalue: \"%s\"\n"; in msg_callback()
124 OneOfMessage msg = OneOfMessage_init_zero; in main() local
139 msg.cb_values.funcs.decode = msg_callback; in main()
141 if (!pb_decode(&stream, OneOfMessage_fields, &msg)) in main()
148 if (msg.which_values == OneOfMessage_intvalue_tag) in main()
[all …]
Dencode_oneof.c62 OneOfMessage msg = OneOfMessage_init_zero; in main() local
75 msg.prefix = 123; in main()
80 msg.which_values = OneOfMessage_intvalue_tag; in main()
81 msg.values.intvalue = 999; in main()
85 msg.which_values = OneOfMessage_strvalue_tag; in main()
86 strcpy(msg.values.strvalue, "abcd"); in main()
90 msg.which_values = OneOfMessage_submsg1_tag; in main()
91 msg.values.submsg1.array.funcs.encode = encode_int32_array; in main()
95 msg.which_values = OneOfMessage_submsg2_tag; in main()
96 msg.values.submsg2.strvalue.funcs.encode = encode_string; in main()
[all …]
/nanopb-2.7.6/tests/regression/issue_363/
Dtest_oneofmsg.c17 BodyMessage msg = BodyMessage_init_zero; in main() local
19 msg.which_body_type = BodyMessage_device_data_crypted_tag; in main()
20 msg.body_type.device_data_crypted.size = 252; in main()
21 memset(msg.body_type.device_data_crypted.bytes, 0xAA, 252); in main()
23 TEST(pb_encode(&stream, BodyMessage_fields, &msg)); in main()
31 BodyMessage msg = BodyMessage_init_zero; in main() local
33 TEST(pb_decode(&stream, BodyMessage_fields, &msg)); in main()
35 TEST(msg.which_body_type == BodyMessage_device_data_crypted_tag); in main()
36 TEST(msg.body_type.device_data_crypted.size == 252); in main()
37 TEST(msg.body_type.device_data_crypted.bytes[251] == 0xAA); in main()
/nanopb-2.7.6/tests/intsizes/
Dintsizes_unittests.c75 IntSizes msg = IntSizes_init_zero; in main() local
78 TEST(sizeof(msg.req_int8) == 1); in main()
79 TEST(sizeof(msg.req_uint8) == 1); in main()
80 TEST(sizeof(msg.req_sint8) == 1); in main()
81 TEST(sizeof(msg.req_int16) == 2); in main()
82 TEST(sizeof(msg.req_uint16) == 2); in main()
83 TEST(sizeof(msg.req_sint16) == 2); in main()
84 TEST(sizeof(msg.req_int32) == 4); in main()
85 TEST(sizeof(msg.req_uint32) == 4); in main()
86 TEST(sizeof(msg.req_sint32) == 4); in main()
[all …]
/nanopb-2.7.6/tests/any_type/
Dencode_any.c11 BaseMessage msg = BaseMessage_init_zero; in main() local
17 msg.start = 1234; in main()
18 msg.end = 5678; in main()
21 msg.has_details = true; in main()
22 …strncpy(msg.details.type_url, "type.googleapis.com/google.protobuf.Duration", sizeof(msg.details.t… in main()
27 stream = pb_ostream_from_buffer(msg.details.value.bytes, sizeof(msg.details.value.bytes)); in main()
30 msg.details.value.size = stream.bytes_written; in main()
34 if (pb_encode(&stream, BaseMessage_fields, &msg)) in main()
/nanopb-2.7.6/tests/stackusage/
Dstackusage.c47 SettingsGroup msg = SettingsGroup_init_zero; in do_encode() local
50 msg.has_settings = true; in do_encode()
51 msg.settings.id = 1; in do_encode()
52 strcpy(msg.settings.name, "abcd"); in do_encode()
53 msg.settings.en = true; in do_encode()
54 msg.settings.has_begin = true; in do_encode()
55 msg.settings.begin.label = 1234; in do_encode()
56 msg.settings.begin.properties_count = 1; in do_encode()
57 msg.settings.begin.properties[0].which_field = Property_DeviceA_Mode_tag; in do_encode()
58 msg.settings.begin.properties[0].field.DeviceA_Mode = 2; in do_encode()
[all …]
/nanopb-2.7.6/tests/regression/issue_376/
Dtest_fixarray.c17 MainMessage msg = MainMessage_init_zero; in main() local
19 msg.submsg.data[0] = 0; in main()
20 msg.submsg.data[4] = 5; in main()
22 TEST(pb_encode(&stream, MainMessage_fields, &msg)); in main()
30 MainMessage msg = MainMessage_init_zero; in main() local
32 TEST(pb_decode(&stream, MainMessage_fields, &msg)); in main()
34 TEST(msg.submsg.data[0] == 0); in main()
35 TEST(msg.submsg.data[4] == 5); in main()
/nanopb-2.7.6/tests/regression/issue_247/
Dpadding.c10 TestMessage msg; in main() local
13 memset(&msg, 0xAA, sizeof(msg)); in main()
16 msg.submsg.boolfield = false; in main()
17 msg.submsg.intfield = 0; in main()
23 TEST(pb_encode(&stream, TestMessage_fields, &msg)); in main()
/nanopb-2.7.6/tests/fuzztest/
Dfuzztest.c71 void *msg = malloc_with_check(structsize); in do_decode() local
74 assert(msg); in do_decode()
76 memset(msg, 0, structsize); in do_decode()
83 ((alltypes_static_AllTypes*)msg)->extensions = &ext; in do_decode()
87 ((alltypes_pointer_AllTypes*)msg)->extensions = &ext; in do_decode()
91 status = pb_decode_ex(&stream, msgtype, msg, flags); in do_decode()
95 validate_message(msg, structsize, msgtype); in do_decode()
104 pb_release(msgtype, msg); in do_decode()
105 free_with_check(msg); in do_decode()
117 void *msg = malloc_with_check(structsize); in do_stream_decode() local
[all …]
/nanopb-2.7.6/tests/msgid/
Ddecode_msgid.c25 MyMessage1 msg = MyMessage1_init_default; in handle_MyMessage1() local
27 if (!pb_decode(stream, MyMessage1_fields, &msg)) in handle_MyMessage1()
30 printf("Got MyMessage1: intvalue = %d\n", (int)msg.intvalue); in handle_MyMessage1()
36 MyMessage2 msg = MyMessage2_init_default; in handle_MyMessage2() local
38 if (!pb_decode(stream, MyMessage2_fields, &msg)) in handle_MyMessage2()
42 (int)msg.intvalue, msg.strvalue); in handle_MyMessage2()
48 MyMessage3 msg = MyMessage3_init_default; in handle_MyMessage3() local
50 if (!pb_decode(stream, MyMessage3_fields, &msg)) in handle_MyMessage3()
53 printf("Got MyMessage3: boolvalue = %d\n", (int)msg.boolvalue); in handle_MyMessage3()
Dencode_msgid.c27 MyMessage1 msg = MyMessage1_init_default; in encode_MyMessage1() local
28 msg.intvalue = 1234; in encode_MyMessage1()
30 && pb_encode(stream, MyMessage1_fields, &msg); in encode_MyMessage1()
35 MyMessage2 msg = MyMessage2_init_default; in encode_MyMessage2() local
36 msg.intvalue = 9999; in encode_MyMessage2()
37 strcpy(msg.strvalue, "Msg2"); in encode_MyMessage2()
39 && pb_encode(stream, MyMessage2_fields, &msg); in encode_MyMessage2()
44 MyMessage3 msg = MyMessage3_init_default; in encode_MyMessage3() local
45 msg.boolvalue = true; in encode_MyMessage3()
47 && pb_encode(stream, MyMessage3_fields, &msg); in encode_MyMessage3()
/nanopb-2.7.6/tests/float_double_conversion/
Dfloat_double_conversion.c49 DoubleMsg msg = { 0.0 }; in main() local
50 msg.value = orig_double; in main()
51 TEST(pb_encode(&stream, &DoubleMsg_msg, &msg)); in main()
60 FloatMsg msg = { 0.0f }; in main() local
61 TEST(pb_decode(&stream, &FloatMsg_msg, &msg)); in main()
62 TEST(memcmp(&msg.value, &expected_float, sizeof(float)) == 0); in main()
66 TEST(pb_encode(&ostream, &FloatMsg_msg, &msg)); in main()
74 DoubleMsg msg = { 0.0 }; in main() local
75 TEST(pb_decode(&stream, &DoubleMsg_msg, &msg)); in main()
80 TEST(isnan(msg.value)); in main()
[all …]
/nanopb-2.7.6/tests/typename_mangling/
Dtest_package_initials.c11 cen_TopLevelMessage msg = {0}; in main() local
12 cen_TopLevelMessage_NestedMessage_NestedLevel2_NestedLevel3 nmsg = msg.nested.nested.nested; in main()
14 msg.short_if_none = cen_TopLevelMessage_ShortIfNone_IfNone_A; in main()
15 msg.short_if_strip_package = cen_TopLevelMessage_ShortIfStripPackage_IfPackage_A; in main()
16 msg.short_if_flatten = cen_TopLevelMessage_ShortIfFlatten_IfFlatten_A; in main()

123