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.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index 77ff1e7ed3..c937916941 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -30,6 +30,7 @@ test_case_bsu_process (test_t test)
{
bsu_test_t t;
bsu_test_init (&t);
+ bsu_activate (true);
test_case_begin (test, "BSU process");
test_begin (test, "Process function on neighbour beacon")
{
@@ -78,7 +79,7 @@ test_case_bsu_process (test_t test)
test_fail_unless (t.bsu->avlns[0].sync.beacon_nb == 2);
blk_release_desc ((blk_t*) bneighbour);
/* Our AVLN. */
- bsu_track_avln (t.bsu, 0x2, 0x5, t.mac_config.tei);
+ bsu_track_avln (0x2, 0x5, t.mac_config.tei);
bsu_test_create_beacon (&t, &beacon);
beacon.vf.nid = 0x2;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
@@ -126,6 +127,7 @@ test_case_bsu_update (test_t test)
bsu_test_t t;
bsu_beacon_t beacon;
bsu_test_init (&t);
+ bsu_activate (true);
test_case_begin (test, "BSU Update");
test_begin (test, "update BSU in time")
{
@@ -231,6 +233,7 @@ test_case_bsu_timer_event (test_t test)
bsu_test_t t;
bsu_avln_t cmp_avln;
bsu_test_init (&t);
+ bsu_activate (true);
bsu_test_avln_create (&t, t.bsu->sta_avln);
bsu_test_avln_create (&t, &cmp_avln);
for (i = 0; i < BSU_ACLF_BPSD_NB; i++)
@@ -262,6 +265,7 @@ test_case_bsu_timer_event (test_t test)
uint i,j;
bsu_avln_t cmp_avln;
bsu_test_init (&t);
+ bsu_activate (true);
bsu_test_avln_create (&t, &cmp_avln);
for (i = 0; i < BSU_ACLF_BPSD_NB; i++)
t.bsu->aclf->bpsd[i] = i * BSU_ACLF_BP_50HZ_TCK;
@@ -313,9 +317,35 @@ test_case_bsu_timer_event (test_t test)
}
void
+test_case_bsu_activate (test_t test)
+{
+ bsu_test_t t;
+ bsu_test_init (&t);
+ test_case_begin (test, "BSU activate");
+ test_begin (test, "Activate/deactivate")
+ {
+ u32 bpsd[4];
+ uint i;
+ bsu_activate (true);
+ test_fail_unless (t.bsu->activate == true);
+ bsu_aclf_beacon_period_start_date (t.bsu->aclf, bpsd, COUNT(bpsd));
+ for (i = 0; i < COUNT (bpsd) - 1; i++)
+ test_fail_unless (bpsd[i] != bpsd[i+1]);
+ test_fail_unless (t.ca.nb_beacon_periods == 4);
+ for (i = 0; i < COUNT (bpsd); i++)
+ test_fail_unless (t.ca.beacon_periods[i].start_date == bpsd[i]);
+ bsu_activate (false);
+ test_fail_unless (t.bsu->activate == false);
+ }
+ test_end;
+ bsu_test_uninit (&t);
+}
+
+void
test_suite_bsu (test_t t)
{
test_suite_begin (t, "BSU test");
+ test_case_bsu_activate (t);
test_case_bsu_process (t);
test_case_bsu_update (t);
test_case_bsu_timer_event (t);