summaryrefslogtreecommitdiff
path: root/libcr/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libcr/tests')
-rw-r--r--libcr/tests/test_matrix.c20
-rw-r--r--libcr/tests/test_matrix/config.h14
2 files changed, 34 insertions, 0 deletions
diff --git a/libcr/tests/test_matrix.c b/libcr/tests/test_matrix.c
new file mode 100644
index 0000000..f1aa6fe
--- /dev/null
+++ b/libcr/tests/test_matrix.c
@@ -0,0 +1,20 @@
+/* libcr/tests/test_matrix.c - Tests for libcr
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#include <stdlib.h> /* for exit(3) */
+
+#include <libcr/coroutine.h>
+
+COROUTINE cr_init(void *) {
+ cr_begin();
+ exit(0);
+ cr_end();
+}
+
+int main() {
+ coroutine_add("init", cr_init, NULL);
+ coroutine_main();
+}
diff --git a/libcr/tests/test_matrix/config.h b/libcr/tests/test_matrix/config.h
new file mode 100644
index 0000000..9802f08
--- /dev/null
+++ b/libcr/tests/test_matrix/config.h
@@ -0,0 +1,14 @@
+/* config.h - TODO
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (4*1024)
+#define CONFIG_COROUTINE_NAME_LEN 16
+#define CONFIG_COROUTINE_NUM 1
+
+#endif /* _CONFIG_H_ */