13 PackageMainMessage defaultMessage = PACKAGE_MAIN_MESSAGE_INIT_DEFAULT;
14 PackageMainMessage message = PACKAGE_MAIN_MESSAGE_INIT_ZERO;
17 TEST(defaultMessage.myEnum5 == PACKAGE_MY_ENUM1_ENTRY_SECOND);
20 message.luckyNumber = 13;
21 message.requiredNumber = 1;
22 message.repeatedNumber[0] = 1;
23 message.repeatedInts =
NULL;
25 message.myEnum1 = PACKAGE_MY_ENUM1_ENUM_THIRD;
26 message.myEnum2 = PACKAGE_MY_ENUM2_ENUM2_ENTRY;
27 message.myEnum3 = PACKAGE_MY_ENUM2_ENUM2_ENTRY;
28 message.myEnum4.arg =
NULL;
30 message.stringValues1 =
NULL;
31 message.stringValues2[0][0] =
'a';
32 message.optionalString.arg =
NULL;
33 message.requiredString[0] =
'a';
35 message.repeatedFixed32[0] = 1;
37 message.requiredBytes1[0] = 0;
38 message.requiredBytes2.size = 0;
39 message.repeatedBytes1_count = 0;
40 message.repeatedBytes2 =
NULL;
42 message.has_subMessage1 =
true;
43 message.subMessage1.has_testValue =
true;
44 message.subMessage1.testValue = 0;
45 message.subMessage2.arg =
NULL;
46 message.subMessage3.testValue = 0;
48 message.which_oneOfName = PACKAGE_MAIN_MESSAGE_TEST_MESSAGE2_TAG;
49 message.oneOfName.testMessage2.has_testValue =
true;
50 message.oneOfName.testMessage2.testValue = 5;
52 message.which_oneOfName2 = PACKAGE_MAIN_MESSAGE_TEST_MESSAGE5_TAG;
53 message.testMessage5.testValue = 5;
55 TEST(
strcmp(
"ENTRY_FIRST", PackageMyEnum1Name(PACKAGE_MY_ENUM1_ENTRY_FIRST)) == 0);
56 TEST(PackageMyEnum1Valid(PACKAGE_MY_ENUM1_ENTRY_FIRST) ==
true);
57 TEST(PackageMyEnum2Valid(PACKAGE_MY_ENUM2_ENUM2_ENTRY) ==
true);
68 PackageMainMessage message2 = PACKAGE_MAIN_MESSAGE_INIT_ZERO;
70 TEST(
pb_encode(&ostream1, &PackageMainMessage_msg, &message));
73 TEST(
pb_decode(&istream, &PackageMainMessage_msg, &message2));
76 TEST(
pb_encode(&ostream2, &PackageMainMessage_msg, &message2));
78 TEST(ostream2.bytes_written == ostream1.bytes_written);
79 TEST(
memcmp(buffer1, buffer2, ostream1.bytes_written) == 0);