summaryrefslogtreecommitdiff
path: root/cesar/cp2/cco/bw/test
diff options
context:
space:
mode:
authorboure2008-05-28 14:26:35 +0000
committerboure2008-05-28 14:26:35 +0000
commit007c3e3454ab74d34a3c2eb0f62d626da82b154a (patch)
tree502ce0962a445fe8134a94593729c0b8adc2cfa1 /cesar/cp2/cco/bw/test
parent729156a259f6f6d546c10ccb90a1f25f32581029 (diff)
add new test of bw management creation new schedule
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2125 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/cco/bw/test')
-rw-r--r--cesar/cp2/cco/bw/test/Makefile14
-rw-r--r--cesar/cp2/cco/bw/test/src/bw_test.c89
2 files changed, 96 insertions, 7 deletions
diff --git a/cesar/cp2/cco/bw/test/Makefile b/cesar/cp2/cco/bw/test/Makefile
index a25231de4e..e66c5106c2 100644
--- a/cesar/cp2/cco/bw/test/Makefile
+++ b/cesar/cp2/cco/bw/test/Makefile
@@ -4,13 +4,13 @@ ECOS=y
TARGET_PROGRAMS = schedules bw_prio_heap_test bw_test
-schedules_SOURCES = bw_list_alloc_test.c
-schedules_MODULES = lib cp2/cco/bw
+schedules_SOURCES = bw_list_alloc_test.c
+schedules_MODULES = lib cp2/cco/bw
+
+#bw_prio_heap_test_SOURCES = bw_prio_heap_test.c
+#bw_prio_heap_test_MODULES = lib cp2/cco/bw
-bw_prio_heap_test_SOURCES = bw_prio_heap_test.c
-bw_prio_heap_test_MODULES = lib cp2/cco/bw
-
-bw_test_SOURCES = bw_test.c conn_stub.c
-bw_test_MODULES = lib cp2/cco/bw
+#bw_test_SOURCES = bw_test.c conn_stub.c
+#bw_test_MODULES = lib cp2/cco/bw cp2/conn
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp2/cco/bw/test/src/bw_test.c b/cesar/cp2/cco/bw/test/src/bw_test.c
new file mode 100644
index 0000000000..87c4175f5f
--- /dev/null
+++ b/cesar/cp2/cco/bw/test/src/bw_test.c
@@ -0,0 +1,89 @@
+
+ /* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp2_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "string.h"
+
+#include "lib/bitstream.h"
+
+#include "cp2/cco/bw/bw.h"
+#include "cp2/cco/bw/bw_prio_heap.h"
+
+#include "cp2/conn/conn.h"
+#include "cp2/conn/conn_mgr.h"
+#include "cp2/cp.h"
+#include "cp2/inc/context.h"
+
+#include "lib/list.h"
+
+
+void
+test_case_bw_init_new_sched (test_t test)
+{
+ cp_t cp;
+
+ cp_cco_bw_new_sched(&cp);
+
+ test_case_begin(test, "\nInit new schedule");
+
+ test_begin(test,"Init new schedule")
+ {
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_begin(&cp.bw.actual_schedule))->glid != 0xFF,
+ "wrong mincsma GLID");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_begin(&cp.bw.actual_schedule))->st_atu != 141,
+ "wrong mincsma start time ");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_begin(&cp.bw.actual_schedule))->et_atu != 141+147,
+ "wrong mincsma end time");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_next(list_begin(&cp.bw.actual_schedule)))->glid != 0xFC,
+ "wrong cfpi GLID");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_next(list_begin(&cp.bw.actual_schedule)))->st_atu != 141+147,
+ "wrong cfpi start time");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_next(list_begin(&cp.bw.actual_schedule)))->et_atu != 141+147+390,
+ "wrong cfpi end time");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_rbegin(&cp.bw.actual_schedule))->glid!=0xFF,
+ "wrong end TDMA protection GLID");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_rbegin(&cp.bw.actual_schedule))->st_atu!=3906-10,
+ "wrong end TDMA protection start time");
+ test_fail_if(PARENT_OF(cp_cco_bw_alloc_conn_t, node,
+ list_rbegin(&cp.bw.actual_schedule))->et_atu!=3906,
+ "wrong end TDMA protection end time");
+ }
+ test_end;
+}
+
+int
+main (void){
+ test_t test;
+
+ test_init(test, 0, NULL);
+
+ test_case_bw_init_new_sched (test);
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}