Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
#include "pch.h" |
2 |
|
|
|
#include "scheduler.h" |
3 |
|
|
|
|
4 |
|
|
|
namespace { |
5 |
|
|
|
struct A{int a;}; |
6 |
|
|
|
struct B{int b;}; |
7 |
|
|
|
|
8 |
|
|
1 |
void foo(uintptr_t p){ } |
9 |
|
|
1 |
void bar(char c){ } |
10 |
|
|
|
|
11 |
|
|
1 |
void a_func(A* a){ a-> a = 64;} |
12 |
|
|
1 |
void b_func(B* b){ b-> b = 32;} |
13 |
|
|
|
} |
14 |
|
|
|
|
15 |
|
|
4 |
TEST(scheduler, action_s) { |
16 |
|
|
|
|
17 |
|
|
1 |
A a{}; |
18 |
|
|
1 |
B b{}; |
19 |
|
|
|
|
20 |
|
|
1 |
uintptr_t uptr{}; |
21 |
|
|
1 |
char c{}; |
22 |
|
|
|
|
23 |
|
|
1 |
auto const foo_act{ action_s::make<foo>(uptr) }; |
24 |
|
|
1 |
auto const bar_act{ action_s::make<bar>(c) }; |
25 |
|
|
|
|
26 |
|
|
1 |
foo_act.execute(); |
27 |
|
|
1 |
bar_act.execute(); |
28 |
|
|
|
|
29 |
|
|
1 |
auto const a_act{ action_s::make<a_func>(&a) }; |
30 |
|
|
1 |
auto const b_act{ action_s::make<b_func>(&b) }; |
31 |
|
|
|
|
32 |
|
|
1 |
a_act.execute(); |
33 |
|
|
1 |
b_act.execute(); |
34 |
|
|
|
|
35 |
|
|
1 |
ASSERT_EQ(a.a, 64); |
36 |
|
|
1 |
ASSERT_EQ(b.b, 32); |
37 |
|
|
|
} |
38 |
|
|
|
|