summaryrefslogtreecommitdiff
path: root/cesar/mac/common/test/ntb/src
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/common/test/ntb/src')
-rw-r--r--cesar/mac/common/test/ntb/src/test_ntb.c55
-rw-r--r--cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c47
2 files changed, 102 insertions, 0 deletions
diff --git a/cesar/mac/common/test/ntb/src/test_ntb.c b/cesar/mac/common/test/ntb/src/test_ntb.c
new file mode 100644
index 0000000000..eb7e6570de
--- /dev/null
+++ b/cesar/mac/common/test/ntb/src/test_ntb.c
@@ -0,0 +1,55 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/common/test/ntb/src/test_ntb.c
+ * \brief test the ntb date.
+ * \ingroup mac_common
+ *
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+#include "mac/common/ntb.h"
+#include "mac/common/config.h"
+#include "hal/phy/phy.h"
+
+
+int main (void)
+{
+ test_t test;
+
+ mac_config_t mac_config;
+ phy_t *phy;
+
+ test_init(test, 0, NULL);
+
+ phy = blk_alloc();
+
+ mac_ntb_init(phy, &mac_config);
+ mac_config.ntb_offset_tck = 10;
+
+ test_begin(test, "test ntb")
+ {
+ test_fail_if(mac_ntb() != 62, "Error on getting ntb date");
+ }
+ test_end;
+
+ mac_ntb_uninit();
+ blk_release(phy);
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_date (phy_t *phy)
+{
+ dbg_assert(phy);
+ return 52;
+}
+
diff --git a/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c b/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c
new file mode 100644
index 0000000000..2fbc005081
--- /dev/null
+++ b/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c
@@ -0,0 +1,47 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/common/test/ntb/src/test_ntb.c
+ * \brief test the ntb date.
+ * \ingroup mac_common
+ *
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+#include "mac/common/ntb.h"
+#include "mac/common/config.h"
+
+
+int main (void)
+{
+ test_t test;
+
+ mac_config_t mac_config;
+ phy_t *phy;
+
+ test_init(test, 0, NULL);
+
+ phy = blk_alloc();
+
+ mac_ntb_init (phy, &mac_config);
+ mac_config.ntb_offset_tck = 10;
+
+ test_begin(test, "test ntb")
+ {
+ test_fail_if(mac_ntb() != 52, "Error on getting ntb date");
+ }
+ test_end;
+
+ mac_ntb_uninit();
+ blk_release (phy);
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+