diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/regress.c | 30 | ||||
-rw-r--r-- | test/regress.rpc | 5 |
2 files changed, 34 insertions, 1 deletions
diff --git a/test/regress.c b/test/regress.c index f1f21175..78c69d18 100644 --- a/test/regress.c +++ b/test/regress.c @@ -1417,6 +1417,12 @@ rpc_test(void) EVTAG_ASSIGN(attack, weapon, "feather"); EVTAG_ASSIGN(attack, action, "tickle"); + for (i = 0; i < 3; ++i) { + if (EVTAG_ADD(attack, how_often, i) == NULL) { + fprintf(stderr, "Failed to add how_often.\n"); + exit(1); + } + } gettimeofday(&tv_start, NULL); for (i = 0; i < 1000; ++i) { @@ -1426,6 +1432,8 @@ rpc_test(void) exit(1); } EVTAG_ASSIGN(run, how, "very fast but with some data in it"); + EVTAG_ASSIGN(run, fixed_bytes, + (uint8_t*)"012345678901234567890123"); } if (msg_complete(msg) == -1) { @@ -1464,11 +1472,33 @@ rpc_test(void) exit(1); } + if (EVTAG_GET(msg2, attack, &attack) == -1) { + fprintf(stderr, "Get not get attack.\n"); + exit(1); + } + if (EVTAG_LEN(msg2, run) != i) { fprintf(stderr, "Wrong number of run messages.\n"); exit(1); } + if (EVTAG_LEN(attack, how_often) != 3) { + fprintf(stderr, "Wrong number of how_often ints.\n"); + exit(1); + } + + for (i = 0; i < 3; ++i) { + uint32_t res; + if (EVTAG_GET(attack, how_often, i, &res) == -1) { + fprintf(stderr, "Cannot get %dth how_often msg.\n", i); + exit(1); + } + if (res != i) { + fprintf(stderr, "Wrong message encoded %d != %d\n", i, res); + exit(1); + } + } + msg_free(msg); msg_free(msg2); diff --git a/test/regress.rpc b/test/regress.rpc index 3c538f75..395efc01 100644 --- a/test/regress.rpc +++ b/test/regress.rpc @@ -10,9 +10,12 @@ struct msg { struct kill { string weapon = 0x10121; string action = 2; - optional int how_often = 3; + array int how_often = 3; } struct run { string how = 1; + optional bytes some_bytes = 2; + + bytes fixed_bytes[24] = 3; } |