summaryrefslogtreecommitdiff
path: root/cesar/cp2/msg
diff options
context:
space:
mode:
authorlaranjeiro2008-07-15 15:05:52 +0000
committerlaranjeiro2008-07-15 15:05:52 +0000
commit3162f81e30750f8deea12529d4ae3496696a358d (patch)
tree8d282b0817971e09d806f1acd9e0a07b75ff4e1b /cesar/cp2/msg
parentcd3fc7a4c1ea426b33d9ac164d080c0bb3d13591 (diff)
cp2/msg: Fixing the test to simulate the reception of a MME fragmented.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2611 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/msg')
-rw-r--r--cesar/cp2/msg/src/msg.c6
-rw-r--r--cesar/cp2/msg/test/src/cc_set_tei_map_frag.c90
2 files changed, 51 insertions, 45 deletions
diff --git a/cesar/cp2/msg/src/msg.c b/cesar/cp2/msg/src/msg.c
index fbc5ab1cc3..8c0d954b29 100644
--- a/cesar/cp2/msg/src/msg.c
+++ b/cesar/cp2/msg/src/msg.c
@@ -758,9 +758,7 @@ cp_msg_mme_rx_change_buffer (cp_t *ctx, cp_mme_rx_t *msg)
// Change the current pointer to the next one.
msg->p_frag_current = msg->p_frag_current->next;
- bitstream_init (&msg->bitstream, msg->p_frag_current->data,
- BLK_SIZE, BITSTREAM_READ);
- msg->bitstream.start = msg->p_frag_current->data;
- msg->bitstream.stream = (uint *) msg->p_frag_current->data;
+ bitstream_init (&msg->bitstream, msg->p_frag_current->data, BLK_SIZE,
+ BITSTREAM_READ);
}
diff --git a/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c b/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
index 96c5a71789..85990ff1a2 100644
--- a/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
+++ b/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
@@ -55,7 +55,7 @@ test_case_msg_cc_set_tei_map_frag (void)
bitstream_t stream;
mme_header_t header;
mac_config_t mac_config;
- cp_mme_rx_t* msg_rx;
+ cp_mme_rx_t msg_rx;
mac_t mac;
cp_tei_t tei;
@@ -165,46 +165,54 @@ test_case_msg_cc_set_tei_map_frag (void)
test_end
bitstream_finalise (&stream);
-// test_case_begin (test, "CC_SET_TEI_MAP.IND received frag");
-// // Store the payload of the first buffer to the blocks.
-// frag_first = blk_alloc_desc_range (4, &frag_last);
-//
-// offset = 19;
-// memcpy (frag_first->data, buffer1 + offset, BLK_SIZE);
-// offset += BLK_SIZE;
-// memcpy (frag_first->next->data, buffer1 + offset, BLK_SIZE);
-//
-// offset += BLK_SIZE;
-// memcpy (frag_first->next->next->data, buffer1 + offset, 506);
-// offset = 19;
-// memcpy (frag_first->next->next->data, buffer2 + offset, 6);
-//
-// offset += 6;
-// memcpy (frag_first->next->next->next->data, buffer2 + offset, BLK_SIZE);
-// frag_last->next = NULL;
-//
-// msg_rx->p_frag = frag_first;
-// msg_rx->p_frag_current = frag_first;
-// msg_rx->length = 1600;
-// bitstream_init (&msg_rx->bitstream, msg_rx->p_frag->data, 512,
-// BITSTREAM_READ);
-// cp_msg_cc_set_tei_map_ind_receive_begin (&cp, msg_rx, &mode, &nb_sta);
-//
-// test_begin (test, "Verify")
-// {
-// for (i = 0; i < nb_sta; i++)
-// {
-// cp_msg_cc_set_tei_map_ind_receive_sta (&cp, msg_rx, &tei, &mac,
-// &status);
-// test_fail_if (mac != i + 1, "Wrong mac address");
-// test_fail_if (tei != i + 1, "Wrong TEI");
-// test_fail_if (status != 0, "Wrong status");
-// }
-// }
-// test_end;
-//
-// cp_msg_cc_set_tei_map_ind_receive_end (&cp, msg_rx);
-// slab_release (msg_rx);
+ test_case_begin (test, "CC_SET_TEI_MAP.IND received frag");
+ // Store the payload of the first buffer to the blocks.
+ frag_first = blk_alloc_desc_range (4, &frag_last);
+
+ /* First frag. */
+ offset = 19;
+ memcpy (frag_first->data, buffer1 + offset, BLK_SIZE);
+
+ /* Second frag. */
+ offset += BLK_SIZE;
+ memcpy (frag_first->next->data, buffer1 + offset, BLK_SIZE);
+
+ /* Third frag. */
+ offset += BLK_SIZE;
+ memcpy (frag_first->next->next->data, buffer1 + offset, 475);
+ offset = 19;
+ memcpy (frag_first->next->next->data + 475, buffer2 + offset, BLK_SIZE -
+ 475);
+
+ /* Fourth frag. */
+ offset += BLK_SIZE - 475;
+ memcpy (frag_first->next->next->next->data, buffer2 + offset, BLK_SIZE);
+ frag_last->next = NULL;
+
+ msg_rx.p_frag = frag_first;
+ msg_rx.p_frag_current = frag_first;
+ msg_rx.length = 1600;
+ bitstream_init (&msg_rx.bitstream, msg_rx.p_frag->data, 512,
+ BITSTREAM_READ);
+ cp_msg_cc_set_tei_map_ind_receive_begin (&cp, &msg_rx, &mode, &nb_sta);
+
+ test_begin (test, "Verify")
+ {
+ for (i = 0; i < nb_sta; i++)
+ {
+ cp_msg_cc_set_tei_map_ind_receive_sta (&cp, &msg_rx, &tei, &mac,
+ &status);
+ test_fail_if (mac != i + 1, "Wrong mac address");
+ test_fail_if (tei != i + 1, "Wrong TEI");
+ test_fail_if (status != 0, "Wrong status");
+ }
+ }
+ test_end;
+
+ cp_msg_cc_set_tei_map_ind_receive_end (&cp, &msg_rx);
+ /* Release the blocks allocated. */
+ blk_release_desc_range ((blk_t *) frag_first, (blk_t *) frag_last);
+ blk_release (msg_rx.bitstream.user_data);
}
int