libcopp  2.2.0
coroutine_context_private_data_test.cpp
Go to the documentation of this file.
1 // Copyright 2023 owent
2 
4 
5 #include <cstdio>
6 #include <cstring>
7 #include <iostream>
8 
9 #include "frame/test_macros.h"
10 
11 typedef copp::coroutine_context_container<copp::allocator::default_statck_allocator>
13 
15 
17  public:
18  int operator()(void *priv_data) {
22 
23  copp::this_coroutine::get<test_context_private_data_context_type>()->resume();
26 
27  copp::this_coroutine::get<test_context_private_data_context_type>()->yield(&priv_data);
29 
30  CASE_EXPECT_EQ(copp::this_coroutine::get<test_context_private_data_context_type>(), priv_data);
32 
33  return 0;
34  }
35 };
36 
37 CASE_TEST(coroutine, context_private_data) {
39 
42 
43  test_context_private_data_context_type::ptr_t co =
44  test_context_private_data_context_type::create(test_context_private_data_foo_runner());
46 
49  co->resume(co.get());
50 
53 }
CASE_TEST(coroutine, context_private_data)
static int g_test_coroutine_private_data_status
copp::coroutine_context_container< copp::allocator::default_statck_allocator > test_context_private_data_context_type
#define CASE_EXPECT_EQ(l, r)
Definition: test_macros.h:96