summaryrefslogtreecommitdiff
path: root/libcr/tests
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-24 23:02:59 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-25 08:27:46 -0700
commit839c3c83993b2b8d9d6be20407afdf59be23e701 (patch)
treebfc896e886dcee25955af8db3ed455f8e598f2bb /libcr/tests
parent1ff1f0e3c26e40a92d56630a092d65fac9655b64 (diff)
libcr: Add very basic tests
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_ */