libcopp  1.1.0
fcontext_test.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <cstdio>
3 #include <cstring>
4 
6 #include "frame/test_macros.h"
7 
8 
10 char test_core_fcontext_stack_a[128 * 1024] = { 0 };
11 char test_core_fcontext_stack_b[128 * 1024] = { 0 };
13 
15 {
16  test_core_fcontext_main_func = src.fctx;
17 
18  copp::fcontext::fcontext_t* fc = reinterpret_cast<copp::fcontext::fcontext_t*>(src.data);
19 
22  CASE_EXPECT_EQ(fc, &test_core_fcontext_a_func);
23 
24  src = copp::fcontext::copp_jump_fcontext(test_core_fcontext_b_func, &test_core_fcontext_b_func);
25  fc = reinterpret_cast<copp::fcontext::fcontext_t*>(src.data);
26  CASE_EXPECT_EQ(fc, &test_core_fcontext_b_func);
27  test_core_fcontext_b_func = src.fctx;
28 
31 
32  copp::fcontext::copp_jump_fcontext(test_core_fcontext_main_func, &test_core_fcontext_main_func);
33 
34 }
35 
37 {
40 
41  copp::fcontext::fcontext_t* fc = reinterpret_cast<copp::fcontext::fcontext_t*>(src.data);
42  CASE_EXPECT_EQ(fc, &test_core_fcontext_b_func);
43 
44  test_core_fcontext_a_func = src.fctx;
45  copp::fcontext::copp_jump_fcontext(test_core_fcontext_a_func, fc);
46 }
47 
48 CASE_TEST(core, fcontext)
49 {
52 
55 
56  copp::fcontext::copp_jump_fcontext(test_core_fcontext_a_func, &test_core_fcontext_a_func);
57 
60 }
int g_test_core_fcontext_status
void test_core_fcontext_func_b(::copp::fcontext::transfer_t src)
CASE_TEST(core, fcontext)
void test_core_fcontext_func_a(::copp::fcontext::transfer_t src)
#define CASE_EXPECT_EQ(l, r)
Definition: test_macros.h:62
COPP_BOOST_CONTEXT_DECL fcontext_t COPP_BOOST_CONTEXT_CALLDECL copp_make_fcontext(void *sp, std::size_t size, void(*fn)(transfer_t))
copp::fcontext::fcontext_t test_core_fcontext_b_func
char test_core_fcontext_stack_a[128 *1024]
COPP_BOOST_CONTEXT_DECL transfer_t COPP_BOOST_CONTEXT_CALLDECL copp_jump_fcontext(fcontext_t const to, void *vp)
copp::fcontext::fcontext_t test_core_fcontext_main_func
copp::fcontext::fcontext_t test_core_fcontext_a_func
char test_core_fcontext_stack_b[128 *1024]