summaryrefslogtreecommitdiff
path: root/cesar/bsu
diff options
context:
space:
mode:
authorNicolas Schodet2011-08-16 15:31:22 +0200
committerNicolas Schodet2011-09-08 16:22:56 +0200
commit5abe923a4e56cb5627eb0c378f67939b5565eef9 (patch)
treecc41ce0de5da1a1f339850ac0c21ea1386800f0e /cesar/bsu
parente56cc9e78763d383e51e4b66f21a761826c3f305 (diff)
cesar/bsu/test/utest: document test process
Diffstat (limited to 'cesar/bsu')
-rw-r--r--cesar/bsu/test/utest/src/bsut.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index b25a9cbd60..4ad6722117 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -51,10 +51,11 @@ test_case_bsu_process (test_t test)
pbproc_tx_beacon_params_t bp_tx;
pbproc_rx_beacon_params_t bpneighbour_rx;
pbproc_rx_beacon_params_t bp_rx;
- bsu_test_create_beacon (&t, &beacon_neighbour);
memset (&bp_rx, 0, sizeof (pbproc_rx_beacon_params_t));
memset (&bpneighbour_rx, 0, sizeof (pbproc_rx_beacon_params_t));
t.mac_config.tei = 4;
+ /* => Neighbour beacon with bad CRC. */
+ bsu_test_create_beacon (&t, &beacon_neighbour);
bpneighbour_rx.snid = 0x4;
bpneighbour_rx.bts = 0;
bneighbour = bsu_beacon_write (&beacon_neighbour,
@@ -64,80 +65,87 @@ test_case_bsu_process (test_t test)
bneighbour->phy_pb.pb_rx.pb_measurement.crc_error = true;
bprocessed = bsu_beacon_process (t.bsu, bneighbour, &bpneighbour_rx);
blk_release_desc ((blk_t*) bneighbour);
- /* Central beacon processed ? */
+ /* Central beacon processed? */
test_fail_unless (!bprocessed);
test_fail_unless (t.bsu->avlns[0].snid == 0);
test_fail_unless (t.bsu->avlns[0].beacon.vf.nid == 0);
test_fail_unless (t.bsu->beacon_nb_sent [BSU_BEACON_TYPE_CENTRAL]
== 0);
- /* NTB called ? */
+ /* NTB called? */
test_fail_unless (t.bsu->avlns[0].sync.init == false);
+ /* => First neighbour beacon reception. */
bneighbour = bsu_beacon_write (&beacon_neighbour,
BSU_BEACON_TYPE_CENTRAL,
&t.mac_config,
&bpneighbour_tx);
bneighbour->phy_pb.pb_rx.pb_measurement.crc_error = false;
bprocessed = bsu_beacon_process (t.bsu, bneighbour, &bpneighbour_rx);
- /* Central beacon processed ? */
+ /* Central beacon processed? */
test_fail_unless (bprocessed);
- test_fail_unless (!bprocessed->params.frequency_error_valid);
test_fail_unless (t.bsu->avlns[0].snid == bpneighbour_rx.snid);
test_fail_unless (t.bsu->avlns[0].beacon.vf.nid
== beacon_neighbour.vf.nid);
test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
== 1);
- blk_release (bprocessed);
- /* NTB called ? */
+ /* NTB called? */
test_fail_unless (t.bsu->avlns[0].sync.init == true);
- /* Second shoot... */
+ test_fail_unless (!bprocessed->params.frequency_error_valid);
+ /* Cleanup. */
+ blk_release (bprocessed);
+ /* => Second neighbour beacon reception. */
bprocessed = bsu_beacon_process (t.bsu, bneighbour, &bpneighbour_rx);
- /* Central beacon processed ? */
+ /* Central beacon processed? */
test_fail_unless (bprocessed);
test_fail_unless (t.bsu->avlns[0].snid == bpneighbour_rx.snid);
test_fail_unless (t.bsu->avlns[0].beacon.vf.nid
== beacon_neighbour.vf.nid);
- /* NTB called ? */
+ test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
+ == 2);
+ /* NTB called? */
test_fail_unless (t.bsu->avlns[0].sync.init == true);
test_fail_unless (bprocessed->params.frequency_error_valid);
+ /* Cleanup. */
blk_release_desc ((blk_t*) bneighbour);
- test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
- == 2);
blk_release (bprocessed);
- /* Our AVLN. */
+ /* => Our AVLN. */
bsu_track_avln (t.bsu,
beacon_neighbour.vf.nid, 0x4, beacon_neighbour.vf.stei,
beacon_neighbour.bmis.mac_address.mac_address);
+ /* Reset synchronisation. */
t.bsu->sta_avln->sync.init = false;
+ /* => Beacon with bad CRC. */
bsu_test_create_beacon (&t, &beacon);
+ bp_rx.snid = 0x4;
+ bp_rx.bts = 0;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
&t.mac_config, &bp_tx);
b->phy_pb.pb_rx.pb_measurement.crc_error = true;
bprocessed = bsu_beacon_process (t.bsu, b, &bp_rx);
- /* Central beacon processed ? */
+ blk_release_desc ((blk_t*) b);
+ /* Central beacon processed? */
test_fail_unless (!bprocessed);
test_fail_unless (t.bsu->sta_avln->snid == t.bsu->snid_track);
test_fail_unless (t.bsu->sta_avln->beacon.vf.nid == t.bsu->nid_track);
test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
== 2);
- blk_release_desc ((blk_t*) b);
- /* NTB called ? */
+ /* NTB called? */
test_fail_unless (t.bsu->sta_avln->sync.init == false);
- bp_rx.snid = 0x4;
- bp_rx.bts = 0;
+ /* => First beacon reception. */
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
&t.mac_config, &bp_tx);
b->phy_pb.pb_rx.pb_measurement.crc_error = false;
bprocessed = bsu_beacon_process (t.bsu, b, &bp_rx);
- /* Central beacon processed ? */
+ /* Central beacon processed? */
test_fail_unless (bprocessed);
test_fail_unless (t.bsu->sta_avln->snid == bp_rx.snid);
test_fail_unless (t.bsu->sta_avln->beacon.vf.nid == beacon.vf.nid);
test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
== 3);
- /* NTB called ? */
+ /* NTB called? */
test_fail_unless (t.bsu->sta_avln->sync.init == true);
test_fail_unless (t.bsu->sta_avln->sync.second_shoot);
test_fail_unless (bprocessed->params.frequency_error_valid);
+ /* Cleanup. */
blk_release_desc ((blk_t*) b);
blk_release (bprocessed);
}