From 7601e3122482616a324fdfdba9b8fc9b34584adb Mon Sep 17 00:00:00 2001 From: Jackarain Date: Sat, 5 Oct 2024 10:10:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=8F=E7=A8=8B=E9=80=92?= =?UTF-8?q?=E5=BD=92=E8=B0=83=E7=94=A8=E6=B5=8B=E8=AF=95=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E8=AF=B4=E6=98=8E=E5=8D=8F=E7=A8=8B=E9=80=92=E5=BD=92?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E4=B8=8D=E5=8F=97=E9=99=90=E4=BA=8E=E6=A0=88?= =?UTF-8?q?=E5=86=85=E5=AD=98=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/CMakeLists.txt | 1 + tests/test6/CMakeLists.txt | 6 ++++++ tests/test6/test.cpp | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/test6/CMakeLists.txt create mode 100644 tests/test6/test.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3c2b4a4..9caa93d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -17,3 +17,4 @@ if(Qt6_FOUND) endif(Qt6_FOUND) add_subdirectory(test4) +add_subdirectory(test6) diff --git a/tests/test6/CMakeLists.txt b/tests/test6/CMakeLists.txt new file mode 100644 index 0000000..68ea819 --- /dev/null +++ b/tests/test6/CMakeLists.txt @@ -0,0 +1,6 @@ + +add_executable(test6 test.cpp) +target_link_libraries(test6 ucoro) + +add_test(NAME test6 COMMAND test6) +set_target_properties(test6 PROPERTIES FOLDER "ucoro_tests") \ No newline at end of file diff --git a/tests/test6/test.cpp b/tests/test6/test.cpp new file mode 100644 index 0000000..b6785f8 --- /dev/null +++ b/tests/test6/test.cpp @@ -0,0 +1,20 @@ +#include +#define DISABLE_DEBUG_CORO_STACK +#include "ucoro/awaitable.hpp" + + +ucoro::awaitable coro_compute_exec(int value) +{ + if (value == 0) + co_return; + + co_await coro_compute_exec(--value); + + co_return; +} + +int main(int argc, char **argv) +{ + coro_start(coro_compute_exec(1000)); + return 0; +}