summaryrefslogtreecommitdiff
path: root/cesar/cp/msg/test/src/msg_cm.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/msg/test/src/msg_cm.c')
-rw-r--r--cesar/cp/msg/test/src/msg_cm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/cesar/cp/msg/test/src/msg_cm.c b/cesar/cp/msg/test/src/msg_cm.c
index 23fa9761e3..5f278a50e3 100644
--- a/cesar/cp/msg/test/src/msg_cm.c
+++ b/cesar/cp/msg/test/src/msg_cm.c
@@ -1740,7 +1740,7 @@ test_case_cm_amp_map (test_t test)
test_begin (test, "CM_AMP_MAP.REQ send")
{
cp_mme_peer_t peer;
- uint nb_amp = 100;
+ uint nb_amp = 99;
u8 amp[nb_amp];
bitstream_t stream;
uint i;
@@ -1767,7 +1767,7 @@ test_case_cm_amp_map (test_t test)
cp_msg_cm_amp_map_req_send_end (&cp, mme);
/* Verify data. */
- bitstream_read_init (&stream, buffer + 19, nb_amp / 2 + 2);
+ bitstream_read_init (&stream, buffer + 19, mme->length - 19);
bitstream_access (&stream, &cmp, 16);
test_fail_if (cmp != nb_amp);
@@ -1777,13 +1777,17 @@ test_case_cm_amp_map (test_t test)
bitstream_access (&stream, &cmp, 4);
test_fail_if (cmp != amp[i]);
}
+ /* Check padding. */
+ test_fail_unless (bitstream_available_bits (&stream) != 0);
+ test_fail_unless (bitstream_read (&stream, 4) == 0);
bitstream_finalise (&stream);
+ test_fail_unless (bitstream_available_bits (&stream) == 0);
}
test_end;
test_begin (test, "CM_AMP_MAP.REQ receive")
{
- uint nb_amp = 100;
+ uint nb_amp = 99;
u8 amp[nb_amp];
uint i;
uint cmp;
@@ -1808,6 +1812,10 @@ test_case_cm_amp_map (test_t test)
cp_msg_cm_amp_map_req_receive (&cp, &mme, &cmp);
test_fail_if (cmp != amp[i]);
}
+ /* Check padding. */
+ test_fail_unless (bitstream_available_bits (&mme.bitstream) != 0);
+ test_fail_unless (bitstream_read (&mme.bitstream, 4) == 0);
+ test_fail_unless (bitstream_available_bits (&mme.bitstream) == 0);
/* Not done because MME is static. */
//cp_msg_cm_amp_map_req_receive_end (&cp, &mme);