summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/alltypes_callback/alltypes.options1
-rw-r--r--tests/alltypes_callback/decode_alltypes_callback.c17
-rw-r--r--tests/alltypes_proto3_callback/alltypes.options1
-rw-r--r--tests/alltypes_proto3_callback/decode_alltypes_callback.c15
4 files changed, 24 insertions, 10 deletions
diff --git a/tests/alltypes_callback/alltypes.options b/tests/alltypes_callback/alltypes.options
index f01cc9d5..74d7a9c0 100644
--- a/tests/alltypes_callback/alltypes.options
+++ b/tests/alltypes_callback/alltypes.options
@@ -2,7 +2,6 @@
AllTypes.* type:FT_CALLBACK
SubMessage.substuff1 max_size:16
AllTypes.oneof no_unions:true
-* packed:true
# With FT_CALLBACK, these options should get ignored
*.*fbytes fixed_length:true max_size:4
diff --git a/tests/alltypes_callback/decode_alltypes_callback.c b/tests/alltypes_callback/decode_alltypes_callback.c
index 2cdffafa..576ce307 100644
--- a/tests/alltypes_callback/decode_alltypes_callback.c
+++ b/tests/alltypes_callback/decode_alltypes_callback.c
@@ -70,11 +70,15 @@ static bool read_string(pb_istream_t *stream, const pb_field_t *field, void **ar
static bool read_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg)
{
SubMessage submsg = {""};
+ SubMessage *ref = *arg;
if (!pb_decode(stream, SubMessage_fields, &submsg))
return false;
- TEST(memcmp(&submsg, *arg, sizeof(submsg)) == 0);
+ TEST(strcmp(submsg.substuff1, ref->substuff1) == 0);
+ TEST(submsg.substuff2 == ref->substuff2);
+ TEST(submsg.has_substuff3 == ref->has_substuff3);
+ TEST(submsg.substuff3 == ref->substuff3);
return true;
}
@@ -144,11 +148,16 @@ static bool read_repeated_string(pb_istream_t *stream, const pb_field_t *field,
static bool read_repeated_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg)
{
SubMessage** expected = (SubMessage**)arg;
- SubMessage decoded = {""};
- if (!pb_decode(stream, SubMessage_fields, &decoded))
+ SubMessage submsg = {""};
+ if (!pb_decode(stream, SubMessage_fields, &submsg))
return false;
- TEST(memcmp((*expected)++, &decoded, sizeof(decoded)) == 0);
+ TEST(strcmp(submsg.substuff1, (*expected)->substuff1) == 0);
+ TEST(submsg.substuff2 == (*expected)->substuff2);
+ TEST(submsg.has_substuff3 == (*expected)->has_substuff3);
+ TEST(submsg.substuff3 == (*expected)->substuff3);
+ (*expected)++;
+
return true;
}
diff --git a/tests/alltypes_proto3_callback/alltypes.options b/tests/alltypes_proto3_callback/alltypes.options
index f01cc9d5..74d7a9c0 100644
--- a/tests/alltypes_proto3_callback/alltypes.options
+++ b/tests/alltypes_proto3_callback/alltypes.options
@@ -2,7 +2,6 @@
AllTypes.* type:FT_CALLBACK
SubMessage.substuff1 max_size:16
AllTypes.oneof no_unions:true
-* packed:true
# With FT_CALLBACK, these options should get ignored
*.*fbytes fixed_length:true max_size:4
diff --git a/tests/alltypes_proto3_callback/decode_alltypes_callback.c b/tests/alltypes_proto3_callback/decode_alltypes_callback.c
index 17e7f122..2b3c2f32 100644
--- a/tests/alltypes_proto3_callback/decode_alltypes_callback.c
+++ b/tests/alltypes_proto3_callback/decode_alltypes_callback.c
@@ -70,11 +70,14 @@ static bool read_string(pb_istream_t *stream, const pb_field_t *field, void **ar
static bool read_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg)
{
SubMessage submsg = {""};
+ SubMessage *ref = *arg;
if (!pb_decode(stream, SubMessage_fields, &submsg))
return false;
- TEST(memcmp(&submsg, *arg, sizeof(submsg)) == 0);
+ TEST(strcmp(submsg.substuff1, ref->substuff1) == 0);
+ TEST(submsg.substuff2 == ref->substuff2);
+ TEST(submsg.substuff3 == ref->substuff3);
return true;
}
@@ -144,11 +147,15 @@ static bool read_repeated_string(pb_istream_t *stream, const pb_field_t *field,
static bool read_repeated_submsg(pb_istream_t *stream, const pb_field_t *field, void **arg)
{
SubMessage** expected = (SubMessage**)arg;
- SubMessage decoded = {""};
- if (!pb_decode(stream, SubMessage_fields, &decoded))
+ SubMessage submsg = {""};
+ if (!pb_decode(stream, SubMessage_fields, &submsg))
return false;
- TEST(memcmp((*expected)++, &decoded, sizeof(decoded)) == 0);
+ TEST(strcmp(submsg.substuff1, (*expected)->substuff1) == 0);
+ TEST(submsg.substuff2 == (*expected)->substuff2);
+ TEST(submsg.substuff3 == (*expected)->substuff3);
+ (*expected)++;
+
return true;
}