MCPcopy Create free account
hub / github.com/Lwhyz/workspace / main

Function main

test/test_function.cc:62–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62int main() {
63 // Empty
64 {
65 seperate();
66 task_t a;
67 cout<<"sizeof(task_t a) = " << sizeof(a) << endl;
68 assert(!a);
69 task_t b = a;
70 assert(!b);
71 b.reset();
72 task_t c = std::move(b);
73 assert(!c);
74 }
75 // Use stack
76 {
77 seperate();
78 cout<<"sizeof(SmallTask) = "<< sizeof(SmallTask) << endl;
79 task_t a{SmallTask()};
80 cout<<"sizeof(task_t a) = " << sizeof(a) << endl;
81 task_t b = a;
82 assert(a);
83 a();
84 task_t c = std::move(b);
85 assert(!b);
86 assert(c);
87 }
88 // Use heap
89 {
90 seperate();
91 cout<<"sizeof(BigTask) = "<< sizeof(BigTask) << endl;
92 task_t a{BigTask()};
93 cout<<"sizeof(task_t a) = " << sizeof(a) << endl;
94 task_t b = a;
95 assert(a);
96 a();
97 task_t c = std::move(b);
98 assert(!b);
99 assert(c);
100 }
101 // check
102 {
103 seperate();
104 function_<void(int), 64> a([](int){});
105 function_<void(int), 64> b([](int){});
106 cout<<a.inline_size<<endl;
107 cout<<b.inline_size<<endl;
108 // a = b;
109 b = a;
110 }
111}

Callers

nothing calls this directly

Calls 4

seperateFunction · 0.85
SmallTaskClass · 0.85
BigTaskClass · 0.85
resetMethod · 0.80

Tested by

no test coverage detected