summaryrefslogtreecommitdiff
path: root/cesar/bsu/test/utest/src/bsut.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/bsu/test/utest/src/bsut.c')
-rw-r--r--cesar/bsu/test/utest/src/bsut.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index 5d1fdd3e0b..df61f673a4 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -91,7 +91,6 @@ test_case_bsu_process (test_t test)
test_fail_unless (t.bsu->avlns[0].bs.nid == beacon_neighbour.vf.nid);
/* NTB called ? */
test_fail_unless (t.bsu->avlns[0].sync.init == true);
- test_fail_unless (t.bsu->avlns[0].sync.beacon_nb == 2);
blk_release_desc ((blk_t*) bneighbour);
test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
== 2);
@@ -140,6 +139,8 @@ test_case_bsu_process (test_t test)
brx.snid = 0x2;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL, &t.mac_config,
&btx);
+ t.bsu->sta_avln->beacon_recv_bps_tck = phy_date () -
+ BSU_ACLF_BP_50HZ_TCK - 1000;
bsu_beacon_process (t.bsu, b, &brx);
/* Change MAC config TEI for the test. */
bsu_beacon_track_info_t tinfo;
@@ -182,6 +183,8 @@ test_case_bsu_process (test_t test)
brx.snid = 0x3;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_DISCOVER,
&t.mac_config, &btx);
+ t.bsu->sta_avln->beacon_recv_bps_tck = phy_date () -
+ BSU_ACLF_BP_50HZ_TCK - 1000;
bsu_beacon_process (t.bsu, b, &brx);
bsu_avln_t *avln = bsu_avln_get (t.bsu, beacon.vf.nid, brx.snid);
test_fail_unless (avln == NULL);
@@ -389,6 +392,8 @@ test_case_bsu_timer_event_cco_ucco (test_t test, bsu_test_t *t,
t->bsu->beacon.beacon_period_start_date = t->bsu->aclf->bpsd[0] - 1;
for (i = 0; i < 7; i++)
{
+ cmp_avln.beacon_recv_bps_tck = phy_date () - BSU_ACLF_BP_50HZ_TCK -
+ 1000;
bsu_avln_schedules_decrease_countdown (t->bsu, &cmp_avln);
bsu_timer_event_process (t->bsu);
test_fail_unless (t->ul.beacon != INVALID_PTR);
@@ -434,8 +439,12 @@ test_case_bsu_timer_event (test_t test)
t.bsu->aclf->bpsd[i] = i * BSU_ACLF_BP_50HZ_TCK;
for (j = 0; j < 10; j++)
{
- bsu_timer_event_process (t.bsu);
+ t.bsu->sta_avln->beacon_recv_bps_tck = t.bsu->aclf->bpsd[0] -
+ BSU_ACLF_BP_50HZ_TCK;
+ cmp_avln.beacon_recv_bps_tck = t.bsu->aclf->bpsd[0] -
+ BSU_ACLF_BP_50HZ_TCK;
bsu_avln_schedules_decrease_countdown (t.bsu, &cmp_avln);
+ bsu_timer_event_process (t.bsu);
for (i = 0; i < BSU_ACLF_BPSD_NB; i++)
test_fail_unless (
t.bsu->aclf->bpsd[i] = (i+j+1) * BSU_ACLF_BP_50HZ_TCK);
@@ -544,16 +553,6 @@ test_case_bsu_power_on (test_t test)
bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
bsu_power_on (0xa);
test_fail_unless (t.bsu->sta_avln == &t.bsu->poweron);
- uint i;
- for (i = 0; i < COUNT (t.bsu->sta_avln->bs.schedules.hm); i++)
- {
- test_fail_unless (t.bsu->sta_avln->bs.schedules.hm [i]
- == beacon.vf.hm);
- test_fail_unless (t.bsu->sta_avln->bs.schedules.snid [i]
- == 0xa);
- test_fail_unless (t.bsu->sta_avln->bs.schedules.nek_switch[i]
- == 0);
- }
test_fail_unless (
memcmp (&t.bsu->sta_avln->bs.schedules.ps,
&t.bsu->beacon.bmis.ps,
@@ -666,19 +665,16 @@ test_case_bsu_nek_index (test_t test)
bsu_test_init (&t);
test_begin (test, "Current index")
{
- uint i;
- uint index = bsu_nek_index_current ();
- test_fail_unless (index == 0);
- index = bsu_nek_index_next ();
- test_fail_unless (index == 1);
- /* Change NEK index in schedules. */
- for (i = 0; i < BSU_BEACON_SCHEDULES_MAX; i++)
- t.bsu->sta_avln->bs.schedules.nek_switch [i] = 1;
- index = bsu_nek_index_current ();
- test_fail_unless (index == 1);
- /* Next index. */
- index = bsu_nek_index_next ();
- test_fail_unless (index == 0);
+ bsu_test_avln_create (&t, t.bsu->sta_avln);
+ test_fail_unless (bsu_nek_index_current () ==
+ t.bsu->sta_avln->bs.nek_switch);
+ test_fail_unless (bsu_nek_index_next () ==
+ !t.bsu->sta_avln->bs.nek_switch);
+ t.bsu->sta_avln->bs.nek_switch = 1;
+ test_fail_unless (bsu_nek_index_current () ==
+ t.bsu->sta_avln->bs.nek_switch);
+ test_fail_unless (bsu_nek_index_next () ==
+ !t.bsu->sta_avln->bs.nek_switch);
}
test_end;
bsu_test_uninit (&t);