summaryrefslogtreecommitdiff
path: root/stackless_coroutine.c
diff options
context:
space:
mode:
Diffstat (limited to 'stackless_coroutine.c')
-rw-r--r--[-rwxr-xr-x]stackless_coroutine.c77
1 files changed, 29 insertions, 48 deletions
diff --git a/stackless_coroutine.c b/stackless_coroutine.c
index cb169e1..73a55e4 100755..100644
--- a/stackless_coroutine.c
+++ b/stackless_coroutine.c
@@ -1,51 +1,33 @@
-#if 0 /*
-#/ ================================================================
-#/
-#/ stackless_coroutine.c
-#/
-#/ ----------------------------------------------------------------
-#/
-#/ (C) 2025 Mitya Selivanov <guattari.tech>
-#/
-#/ Any use of this code is prohibited.
-#/
-#/ ================================================================
-#/
-#/ Self-testing shell script
-#/
-#/ ================================================================
-SRC=${0##*./}
-BIN=${SRC%.*}
-gcc \
- -Wall -Wextra -Werror -pedantic \
- -Wno-missing-braces \
- -Wno-old-style-declaration \
- -Wno-overlength-strings \
- -Wno-unused-parameter \
- -Wno-unused-variable \
- -Wno-unused-but-set-variable \
- -O3 -D NDEBUG \
- -D STACKLESS_COROUTINE_TEST_SUITE \
- -o $BIN $SRC && \
- ./$BIN $@
-STATUS=$?
-rm -f $BIN
-exit $STATUS # */
-#endif
// ================================================================
-
-typedef signed i32;
-typedef unsigned char b8;
-
+//
+// stackless_coroutine.c
+//
+// ----------------------------------------------------------------
+//
+// (C) 2025 Mitya Selivanov <guattari.tech>
+//
+// Any use of this code is prohibited.
+//
// ================================================================
#ifndef STACKLESS_COROUTINE_HEADER_GUARD_
#define STACKLESS_COROUTINE_HEADER_GUARD_
-#ifdef EVERY_TEST_SUITE
-#define STACKLESS_COROUTINE_TEST_SUITE
+// ================================================================
+//
+// Options
+//
+// ================================================================
+
+#ifndef ENABLE_TESTING
+#define ENABLE_TESTING 0
#endif
+// ================================================================
+
+typedef signed i32;
+typedef unsigned char b8;
+
#ifndef NULL
#define NULL ((void *) 0)
#endif
@@ -251,12 +233,16 @@ static void stackless_coroutine_dispatch(void *promise) {
#endif // STACKLESS_COROUTINE_HEADER_GUARD_
// ================================================================
+//
+// Test suite
+//
+// ================================================================
#ifndef STACKLESS_COROUTINE_HEADER
#ifndef STACKLESS_COROUTINE_IMPL_GUARD_
#define STACKLESS_COROUTINE_IMPL_GUARD_
-#ifdef STACKLESS_COROUTINE_TEST_SUITE
+#if ENABLE_TESTING
#define TEST_FILE stackless_coroutine
#include "test.c"
@@ -403,13 +389,8 @@ TEST("coroutine nested generator") {
REQUIRE(coro_finished(promise));
}
-#ifndef EVERY_TEST_SUITE
-i32 main(i32 argc, c8 **argv) {
- return run_tests(argc, argv);
-}
-#endif
-
-#endif // STACKLESS_COROUTINE_TEST_SUITE
+#undef TEST_FILE
+#endif // ENABLE_TESTING
#endif // STACKLESS_COROUTINE_IMPL_GUARD_
#endif // STACKLESS_COROUTINE_HEADER