aboutsummaryrefslogtreecommitdiff
path: root/tests/lxdrgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lxdrgen.c')
-rw-r--r--tests/lxdrgen.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/lxdrgen.c b/tests/lxdrgen.c
index 14f40e2..78ec47b 100644
--- a/tests/lxdrgen.c
+++ b/tests/lxdrgen.c
@@ -53,6 +53,10 @@ test_ser_deser_free (void)
u->others.bar = str_make ();
for (int i = rand () % 0x30; i > 0; i--)
str_append_c (&u->others.bar, 0x30 + i);
+ u->others.baz_len = rand () % 0x30;
+ u->others.baz = xcalloc (1, u->others.baz_len);
+ for (uint32_t i = 0; i < u->others.baz_len; i++)
+ u->others.baz[i] = 0x30 + i;
break;
case 2:
u->tag = PROTO_GEN_ENUM_NOTHING;
@@ -62,6 +66,8 @@ test_ser_deser_free (void)
}
}
+ a.o.tag = PROTO_GEN_ENUM_NOTHING;
+
struct str buf = str_make ();
hard_assert (proto_gen_struct_serialize (&a, &buf));
struct msg_unpacker r = msg_unpacker_make (buf.str, buf.len);
@@ -92,6 +98,9 @@ test_ser_deser_free (void)
hard_assert (ua->others.bar.len == ub->others.bar.len);
hard_assert (!memcmp (ua->others.bar.str, ub->others.bar.str,
ua->others.bar.len));
+ hard_assert (ua->others.baz_len == ub->others.baz_len);
+ hard_assert (!memcmp (ua->others.baz, ub->others.baz,
+ ua->others.baz_len));
break;
case PROTO_GEN_ENUM_NOTHING:
break;
@@ -100,6 +109,8 @@ test_ser_deser_free (void)
}
}
+ hard_assert (a.o.tag == b.o.tag);
+
// Emulate partially deserialized data to test disposal of that.
for (size_t i = b.u_len - CASES; i < b.u_len; i++)
{