summaryrefslogtreecommitdiff
path: root/cesar/cp2/cco/bw/test/src/bw_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp2/cco/bw/test/src/bw_test.c')
-rw-r--r--cesar/cp2/cco/bw/test/src/bw_test.c183
1 files changed, 180 insertions, 3 deletions
diff --git a/cesar/cp2/cco/bw/test/src/bw_test.c b/cesar/cp2/cco/bw/test/src/bw_test.c
index 95616762aa..9327114561 100644
--- a/cesar/cp2/cco/bw/test/src/bw_test.c
+++ b/cesar/cp2/cco/bw/test/src/bw_test.c
@@ -204,10 +204,63 @@ if(val == 0){\
conn_prio[8]=2;\
conn_prio[9]=3;\
}
+#define INIT_TEST_F_AND_R_ALLOC(val)\
+if(val == 0)\
+{\
+ nb_ble = 10;\
+ \
+ ble_value[0] = 90;\
+ ble_value[1] = 50;\
+ ble_value[2] = 80;\
+ ble_value[3] = 120;\
+ ble_value[4] = 35;\
+ ble_value[5] = 40;\
+ ble_value[6] = 25;\
+ ble_value[7] = 30;\
+ ble_value[8] = 70;\
+ ble_value[9] = 160;\
+ \
+ ble_end_time[0] = 935;\
+ ble_end_time[1] = 1195;\
+ ble_end_time[2] = 1390;\
+ ble_end_time[3] = 1429;\
+ ble_end_time[4] = 1785;\
+ ble_end_time[5] = 2175;\
+ ble_end_time[6] = 3007;\
+ ble_end_time[7] = 3735;\
+ ble_end_time[8] = 3839;\
+ ble_end_time[9] = 3906;\
+ \
+ link_nb_pb[0][0]=20;\
+ link_nb_pb[0][1]=30;\
+ link_nb_pb[1][0]=10;\
+ link_nb_pb[1][1]=15;\
+ link_nb_pb[2][0]=25;\
+ link_nb_pb[2][1]=5;\
+ link_nb_pb[3][0]=10;\
+ link_nb_pb[3][1]=15;\
+ link_nb_pb[4][0]=20;\
+ link_nb_pb[4][1]=30;\
+ \
+ link_prio[0][0]=3;\
+ link_prio[0][1]=3;\
+ link_prio[1][0]=3;\
+ link_prio[1][1]=3;\
+ link_prio[2][0]=2;\
+ link_prio[2][1]=2;\
+ link_prio[3][0]=1;\
+ link_prio[3][1]=1;\
+ link_prio[4][0]=0;\
+ link_prio[4][1]=0;\
+\
+}
+
u16 ble_value[10];
u16 ble_end_time[10];
+u16 link_nb_pb[5][10];
+u16 link_prio[5][10];
u16 conn_nb_pb[10];
u16 conn_prio[10];
u16 nb_pb;
@@ -379,8 +432,8 @@ test_case_complete_allocation (test_t test, u8 test_id)
{
conn[i] = cp_conn_init_conn(&cp);
conn[i]->conn_info.cid = (i+1)*100;
- conn[i]->conn_info.cspec.f_qmp->av_nb_pb = nb_pb;
- conn[i]->conn_info.cspec.f_qmp->nb_txop = 1;
+ conn[i]->flink->qmp->av_nb_pb = nb_pb;
+ conn[i]->flink->qmp->nb_txop = 1;
cp_conn_add_conn(&cp, conn[i]);
/*Init the BLEs*/
@@ -399,7 +452,7 @@ test_case_complete_allocation (test_t test, u8 test_id)
test_case_begin(test, "Try to allocate into the Beacon Period");
for(i=0;i<3;i++)
- cp_cco_bw_alloc(&cp, cp_conn_get_conn(&cp,(i+1)*100));
+ cp_cco_bw_alloc(&cp, cp_conn_get_conn(&cp,(i+1)*100)->flink, (i+1)*100);
for(i=0;i<3;i++)
alloc_test[i] = cp_cco_bw_alloc_get_first_txop(&cp, (i+1)*100);
@@ -711,6 +764,126 @@ test_case_allocate_multiple_txop (test_t test)
test_end;
}
+void
+test_case_f_and_r_alloc (test_t test)
+{
+ cp_t cp;
+ cp_net_t *avln;
+ cp_sta_t *sta;
+ int nb_conn;
+ int j,i;
+
+ cp_cco_bw_alloc_t *alloc_test[13];
+ cp_conn_t *conn[10];
+
+ cp_pwl_init(&cp);
+ cp_sta_mgr_init(&cp);
+ avln = cp_sta_mgr_get_our_avln (&cp);
+ sta =cp_net_sta_add (&cp, avln, 1, 1);
+ cp_cco_bw_init(&cp);
+ cp_conn_mgr_init(&cp);
+
+ /*Init the connections*/
+ for(nb_conn = 0 ; nb_conn < 5 ; nb_conn++)
+ {
+ conn[nb_conn] = cp_conn_init_conn(&cp);
+ conn[nb_conn]->conn_info.cid = (nb_conn+1)*10;
+
+ conn[nb_conn]->flink->cinfo->user_priority = link_prio[nb_conn][0];
+ conn[nb_conn]->flink->qmp->nb_txop = 1;
+ conn[nb_conn]->flink->qmp->av_nb_pb = link_nb_pb[nb_conn][0];
+
+ conn[nb_conn]->rlink->cinfo->user_priority = link_prio[nb_conn][1];
+ conn[nb_conn]->rlink->qmp->nb_txop = 1;
+ conn[nb_conn]->rlink->qmp->av_nb_pb = link_nb_pb[nb_conn][1];
+
+ cp_conn_add_conn(&cp, conn[nb_conn]);
+
+ /*Init the BLEs*/
+ for(j = 0 ; j < nb_ble ; j++)
+ {
+ cp_link_push_ble(conn[nb_conn]->flink, ble_value[j], ble_end_time[j]);
+ cp_link_push_ble(conn[nb_conn]->rlink, ble_value[j], ble_end_time[j]);
+ }
+ }
+
+ test_case_begin(test, "Complete Schedule");
+
+ cp_cco_bw_alloc_sched(&cp);
+
+ alloc_test[0] = cp_cco_bw_get_first_alloc_actual(&cp);
+
+ for(i = 1 ; i < 14 ; i++)
+ alloc_test[i] = cp_cco_bw_get_next_alloc_actual(alloc_test[i-1]);
+
+ test_begin(test, "Complete Schedule")
+ {
+ test_fail_if(alloc_test[4]->st_atu != 819,
+ "wrong allocation st0");
+ test_fail_if(alloc_test[4]->et_atu != 877,
+ "wrong allocation et0");
+ test_fail_if(alloc_test[4]->cid != 20,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[5]->st_atu != 877,
+ "wrong allocation st");
+ test_fail_if(alloc_test[5]->et_atu != 987,
+ "wrong allocation et");
+ test_fail_if(alloc_test[5]->cid != 20,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[6]->st_atu != 1018,
+ "wrong allocation st");
+ test_fail_if(alloc_test[6]->et_atu != 1253,
+ "wrong allocation et");
+ test_fail_if(alloc_test[6]->cid != 30,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[7]->st_atu != 1253,
+ "wrong allocation st");
+ test_fail_if(alloc_test[7]->et_atu != 1429,
+ "wrong allocation et");
+ test_fail_if(alloc_test[7]->cid != 10,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[8]->st_atu != 1429,
+ "wrong allocation st");
+ test_fail_if(alloc_test[8]->et_atu != 1727,
+ "wrong allocation et");
+ test_fail_if(alloc_test[8]->cid != 50,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[9]->st_atu != 1785,
+ "wrong allocation st");
+ test_fail_if(alloc_test[9]->et_atu != 1915,
+ "wrong allocation et");
+ test_fail_if(alloc_test[9]->cid != 40,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[10]->st_atu != 1915,
+ "wrong allocation st");
+ test_fail_if(alloc_test[10]->et_atu != 2110,
+ "wrong allocation et");
+ test_fail_if(alloc_test[10]->cid != 40,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[11]->st_atu != 3007,
+ "wrong allocation st");
+ test_fail_if(alloc_test[11]->et_atu != 3527,
+ "wrong allocation et");
+ test_fail_if(alloc_test[11]->cid != 50,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[12]->st_atu != 3735,
+ "wrong allocation st");
+ test_fail_if(alloc_test[12]->et_atu != 3773,
+ "wrong allocation et");
+ test_fail_if(alloc_test[12]->cid != 30,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[13]->st_atu != 3816,
+ "wrong allocation st");
+ test_fail_if(alloc_test[13]->et_atu != 3896,
+ "wrong allocation et");
+ test_fail_if(alloc_test[13]->cid != 10,
+ "wrong allocation cid");
+ }
+ test_end;
+ blk_release(sta);
+ cp_conn_mgr_uninit(&cp);
+}
+
int
main (void){
@@ -733,6 +906,10 @@ main (void){
test_case_complete_schedule (test);
+ INIT_TEST_F_AND_R_ALLOC(0);
+
+ test_case_f_and_r_alloc (test);
+
for(i=0;i<nb_test;i++)
{
INIT_TEST_MULITPLE_ALLOC(i);