mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-01-05 05:12:15 +00:00
test-marshallers: Check for "zero" attribute
Check the previous fix for "zero" attribute works correctly
(commit bc9df58162, "marshal: Fix a bug
with zero attribute").
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
7050511d9e
commit
2b5cadcd8a
@ -62,6 +62,19 @@ int main(int argc G_GNUC_UNUSED, char **argv G_GNUC_UNUSED)
|
||||
if (free_res) {
|
||||
free(data);
|
||||
}
|
||||
spice_marshaller_reset(marshaller);
|
||||
|
||||
SpiceMsgMainZeroes msg_zeroes = { 0x0102 };
|
||||
|
||||
spice_marshall_msg_main_Zeroes(marshaller, &msg_zeroes);
|
||||
spice_marshaller_flush(marshaller);
|
||||
data = spice_marshaller_linearize(marshaller, 0, &len, &free_res);
|
||||
g_assert_cmpint(len, ==, 7);
|
||||
g_assert_true(memcmp(data, "\x00\x02\x01\x00\x00\x00\x00", 7) == 0);
|
||||
if (free_res) {
|
||||
free(data);
|
||||
}
|
||||
|
||||
spice_marshaller_destroy(marshaller);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -12,5 +12,9 @@ typedef struct {
|
||||
int8_t *name;
|
||||
} SpiceMsgMainArrayMessage;
|
||||
|
||||
typedef struct {
|
||||
uint16_t n;
|
||||
} SpiceMsgMainZeroes;
|
||||
|
||||
#endif /* _H_TEST_MARSHALLERS */
|
||||
|
||||
|
||||
@ -8,6 +8,12 @@ channel TestChannel {
|
||||
message {
|
||||
int8 name[];
|
||||
} ArrayMessage;
|
||||
|
||||
message {
|
||||
uint8 res1 @zero;
|
||||
uint16 n;
|
||||
uint32 res2 @zero;
|
||||
} Zeroes;
|
||||
};
|
||||
|
||||
protocol Spice {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user