summaryrefslogtreecommitdiff
path: root/cesar/cp2/beacon/test
diff options
context:
space:
mode:
authorlaranjeiro2008-06-03 10:57:51 +0000
committerlaranjeiro2008-06-03 10:57:51 +0000
commit44b6f72ea8d0120d32aa278b7186eef461aef727 (patch)
treebbb82f3c205d0ff39ab74307dddd120d4fb5997b /cesar/cp2/beacon/test
parentb8d4b759498b05aede16a8fe499085abf5e7ddfe (diff)
beacon: Tested the reception of a central beacon when the station is
unassociated and associated. (see [wiki:UT-CPM1-BEACON-recv-beacon]) git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2202 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/beacon/test')
-rw-r--r--cesar/cp2/beacon/test/doc/recv-beacon.txt4
-rw-r--r--cesar/cp2/beacon/test/src/sta_receive_central_beacon.c34
2 files changed, 30 insertions, 8 deletions
diff --git a/cesar/cp2/beacon/test/doc/recv-beacon.txt b/cesar/cp2/beacon/test/doc/recv-beacon.txt
index 1814f42963..616d72a9e6 100644
--- a/cesar/cp2/beacon/test/doc/recv-beacon.txt
+++ b/cesar/cp2/beacon/test/doc/recv-beacon.txt
@@ -54,11 +54,9 @@ Station unassociated result
Station associated result
~~~~~~~~~~~~~~~~~~~~~~~~~
-.. Warning:: Not tested yet.
-
* The SNID and NID shall be compared with the one of our AVLN. (No collision in this test).
* The Station shall be added in the station manager if it does not exists (with the MAC address if it exists in the beacon).
-* The num slots and slot usage shall be store in the network data.
+* The slot id and slot usage shall be store in the network data.
* The regions are skipped.
* The schedules are read and provided to the CA.
diff --git a/cesar/cp2/beacon/test/src/sta_receive_central_beacon.c b/cesar/cp2/beacon/test/src/sta_receive_central_beacon.c
index 3c883fb1b9..1c92bd4d21 100644
--- a/cesar/cp2/beacon/test/src/sta_receive_central_beacon.c
+++ b/cesar/cp2/beacon/test/src/sta_receive_central_beacon.c
@@ -38,6 +38,8 @@ static cp_t cp;
static u64 nid_test = 0x123456789ABCDull;
static u8 snid_test = 0xD;
static u8 stei_test = 0xA;
+static u8 slot_id_test = 0x1;
+static u8 slot_usage_test = 0x1;
void
test_create_beacon (cp_beacon_desc_t *beacon)
@@ -55,8 +57,8 @@ test_create_beacon (cp_beacon_desc_t *beacon)
data_work.ncnr = CP_BEACON_NON_COORDINATED_NETWORK;
data_work.npsm = CP_BEACON_NPSM_NOT_ACTIVE;
data_work.num_slots = 1;
- data_work.slot_usage = 0x1;
- data_work.slot_id = 0x1;
+ data_work.slot_usage = slot_usage_test;
+ data_work.slot_id = slot_id_test;
data_work.aclss = 0;
data_work.hoip = CP_BEACON_HOIP_FALSE;
data_work.rtsbf = false;
@@ -118,6 +120,8 @@ test_create_beacon (cp_beacon_desc_t *beacon)
bitstream_access (&bitstream, &data, 7); //GLID
data = 3905;
bitstream_access (&bitstream, &data, 12); // end time.
+ data = 0;
+ bitstream_access (&bitstream, &data, 4); // RSVD
sched_verify.allocations_nb = 3;
sched_verify.allocations[0].end_offset_tck = 13312;
@@ -225,6 +229,8 @@ test_case_recv_cbeacon_associated(void)
uint phy = 0;
cp_beacon_desc_t *beacon;
cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *cco;
cp_beacon_init (&cp);
cp_sta_mgr_init (&cp);
@@ -250,7 +256,9 @@ test_case_recv_cbeacon_associated(void)
cp.pwl.frequency = CP_PWL_FREQ_50;
cp.pwl.bp_ntb = CP_PWL_BP_50;
cp.pwl.zc_ntb = CP_PWL_ZC_50;
- cp.pwl.date_ntb [0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[1] = 2 * cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[2] = 3 * cp.pwl.bp_ntb;
// Initialise our AVLN
cp_sta_mgr_update_our_avln_nid (&cp, nid_test);
@@ -268,6 +276,21 @@ test_case_recv_cbeacon_associated(void)
{
net = cp_sta_mgr_get_avln (&cp, snid_test, nid_test);
test_fail_if (net == NULL, "AVLN shall exits");
+
+ sta = cp_net_get_sta (net, stei_test);
+ test_fail_if (sta == NULL, "Station shall exist");
+ test_fail_if (cp_sta_get_cco_status (sta) != true,
+ "Station shall be CCo");
+ cco = cp_net_get_cco (net);
+ test_fail_if (cco != sta, "Station CCo not referred in the net");
+
+ blk_release (sta);
+ blk_release (cco);
+
+ test_fail_if (cp_net_get_slot_id (net) != slot_id_test,
+ "Wrong slot id");
+ test_fail_if (cp_net_get_slot_usage_mask (net) != slot_usage_test,
+ "Wrong slot usage mask");
}
test_end;
@@ -284,7 +307,7 @@ main (void)
{
test_init (test, 0, NULL);
- test_case_recv_cbeacon_unassociated();
+// test_case_recv_cbeacon_unassociated();
test_case_recv_cbeacon_associated();
test_case_begin (test, "Memory allocation");
@@ -327,7 +350,8 @@ ca_alloc_update_beacon_periods (ca_t *ctx,
for (i = 0; i < beacon_periods_nb; i++)
{
test_fail_if (beacon_periods[i].start_date !=
- cp.pwl.bp_avln_ntb[i], "Wrong Beacon start time");
+ cp.pwl.bp_avln_ntb[i] - (i == 0) ? 0 : 50,
+ "Wrong Beacon start time");
}
}
test_end;