Make all the tests ANSI C compatible.

This commit is contained in:
Petteri Aimonen
2013-09-11 13:16:20 +03:00
parent e2e9980627
commit b9f14bddf7
10 changed files with 100 additions and 54 deletions

View File

@@ -7,12 +7,13 @@
int main()
{
uint8_t buffer[512] = {};
uint8_t buffer[512];
/* Create a message with one missing field */
{
MissingField msg = {};
MissingField msg = {0};
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
if (!pb_encode(&stream, MissingField_fields, &msg))
{
printf("Encode failed.\n");
@@ -22,7 +23,7 @@ int main()
/* Test that it decodes properly if we don't require that field */
{
MissingField msg = {};
MissingField msg = {0};
pb_istream_t stream = pb_istream_from_buffer(buffer, sizeof(buffer));
if (!pb_decode(&stream, MissingField_fields, &msg))
@@ -34,7 +35,7 @@ int main()
/* Test that it does *not* decode properly if we require the field */
{
AllFields msg = {};
AllFields msg = {0};
pb_istream_t stream = pb_istream_from_buffer(buffer, sizeof(buffer));
if (pb_decode(&stream, AllFields_fields, &msg))