summaryrefslogtreecommitdiff
path: root/cesar/hle/test/src/interface-send.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/hle/test/src/interface-send.c')
-rw-r--r--cesar/hle/test/src/interface-send.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/cesar/hle/test/src/interface-send.c b/cesar/hle/test/src/interface-send.c
new file mode 100644
index 0000000000..cbdc66d5d4
--- /dev/null
+++ b/cesar/hle/test/src/interface-send.c
@@ -0,0 +1,98 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hle/test/src/interface-send.c
+ * \brief Test the hle_send function.
+ * \ingroup hle
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "lib/test.h"
+#include "lib/blk.h"
+#include "lib/trace.h"
+
+#include "cl/cl.h"
+
+#include "hle/hle.h"
+#include "lib/test.h"
+
+#include "hle/inc/trace.h"
+
+test_t test;
+bool test_ipmbox_tx;
+bool test_ipmbox_activate;
+
+void
+interface_buffer_work_add (void *user_data, u8 *buffer)
+{
+}
+
+ipmbox_t *ipmbox_init (void *user_data, ipmbox_rx_cb_t rx_cb)
+{
+ return user_data;
+}
+
+void ipmbox_tx (ipmbox_t *ctx, u32 *msg_buffer, uint length)
+{
+ test_case_begin (test, "IPMbox tx");
+
+ test_begin (test, "sending data")
+ {
+ test_fail_if (length != 3, "Wrong length");
+ }
+ test_end;
+}
+
+void
+ipmbox_activate (ipmbox_t *ctx, bool activation)
+{
+ test_ipmbox_activate = true;
+}
+
+
+int main (void)
+{
+ hle_t *hle;
+ cl_t *cl;
+
+ uint word [3];
+
+ test_init (test, 0, NULL);
+
+ cl = blk_alloc ();
+ hle = hle_init (cl);
+
+ test_ipmbox_activate = false;
+
+ hle_activate (hle, true);
+ hle_ipmbox_send (hle, word, 3);
+
+ test_begin (test, "HLE activate")
+ {
+ test_fail_if (test_ipmbox_activate != true, "HLE activate not called");
+ }
+ test_end;
+
+ blk_release (cl);
+
+ test_begin (test, "Memory test")
+ {
+ test_fail_if (blk_check_memory() == false, "Memory not freed");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+