1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Generated mock file from original source file
19  *   Functions generated:11
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 
24 #include <functional>
25 
26 // Original included files, if any
27 #include "osi/include/fixed_queue.h"
28 #include "osi/include/reactor.h"
29 #include "osi/include/thread.h"
30 
31 // Mocked compile conditionals, if any
32 
33 namespace test {
34 namespace mock {
35 namespace osi_thread {
36 
37 // Shared state between mocked functions and tests
38 // Name: thread_free
39 // Params: thread_t* thread
40 // Return: void
41 struct thread_free {
42   std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}};
operatorthread_free43   void operator()(thread_t* thread) { body(thread); };
44 };
45 extern struct thread_free thread_free;
46 
47 // Name: thread_get_reactor
48 // Params: const thread_t* thread
49 // Return: reactor_t*
50 struct thread_get_reactor {
51   reactor_t* return_value{0};
52   std::function<reactor_t*(const thread_t* thread)> body{
53       [this](const thread_t* /* thread */) { return return_value; }};
operatorthread_get_reactor54   reactor_t* operator()(const thread_t* thread) { return body(thread); };
55 };
56 extern struct thread_get_reactor thread_get_reactor;
57 
58 // Name: thread_is_self
59 // Params: const thread_t* thread
60 // Return: bool
61 struct thread_is_self {
62   bool return_value{false};
63   std::function<bool(const thread_t* thread)> body{
64       [this](const thread_t* /* thread */) { return return_value; }};
operatorthread_is_self65   bool operator()(const thread_t* thread) { return body(thread); };
66 };
67 extern struct thread_is_self thread_is_self;
68 
69 // Name: thread_join
70 // Params: thread_t* thread
71 // Return: void
72 struct thread_join {
73   std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}};
operatorthread_join74   void operator()(thread_t* thread) { body(thread); };
75 };
76 extern struct thread_join thread_join;
77 
78 // Name: thread_name
79 // Params: const thread_t* thread
80 // Return: const char*
81 struct thread_name {
82   const char* return_value{0};
83   std::function<const char*(const thread_t* thread)> body{
84       [this](const thread_t* /* thread */) { return return_value; }};
operatorthread_name85   const char* operator()(const thread_t* thread) { return body(thread); };
86 };
87 extern struct thread_name thread_name;
88 
89 // Name: thread_new
90 // Params: const char* name
91 // Return: thread_t*
92 struct thread_new {
93   thread_t* return_value{0};
94   std::function<thread_t*(const char* name)> body{
95       [this](const char* /* name */) { return return_value; }};
operatorthread_new96   thread_t* operator()(const char* name) { return body(name); };
97 };
98 extern struct thread_new thread_new;
99 
100 // Name: thread_new_sized
101 // Params: const char* name, size_t work_queue_capacity
102 // Return: thread_t*
103 struct thread_new_sized {
104   thread_t* return_value{0};
105   std::function<thread_t*(const char* name, size_t work_queue_capacity)> body{
106       [this](const char* /* name */, size_t /* work_queue_capacity */) {
107         return return_value;
108       }};
operatorthread_new_sized109   thread_t* operator()(const char* name, size_t work_queue_capacity) {
110     return body(name, work_queue_capacity);
111   };
112 };
113 extern struct thread_new_sized thread_new_sized;
114 
115 // Name: thread_post
116 // Params: thread_t* thread, thread_fn func, void* context
117 // Return: bool
118 struct thread_post {
119   bool return_value{false};
120   std::function<bool(thread_t* thread, thread_fn func, void* context)> body{
121       [this](thread_t* /* thread */, thread_fn /* func */,
122              void* /* context */) { return return_value; }};
operatorthread_post123   bool operator()(thread_t* thread, thread_fn func, void* context) {
124     return body(thread, func, context);
125   };
126 };
127 extern struct thread_post thread_post;
128 
129 // Name: thread_set_priority
130 // Params: thread_t* thread, int priority
131 // Return: bool
132 struct thread_set_priority {
133   bool return_value{false};
134   std::function<bool(thread_t* thread, int priority)> body{
135       [this](thread_t* /* thread */, int /* priority */) {
136         return return_value;
137       }};
operatorthread_set_priority138   bool operator()(thread_t* thread, int priority) {
139     return body(thread, priority);
140   };
141 };
142 extern struct thread_set_priority thread_set_priority;
143 
144 // Name: thread_set_rt_priority
145 // Params: thread_t* thread, int priority
146 // Return: bool
147 struct thread_set_rt_priority {
148   bool return_value{false};
149   std::function<bool(thread_t* thread, int priority)> body{
150       [this](thread_t* /* thread */, int /* priority */) {
151         return return_value;
152       }};
operatorthread_set_rt_priority153   bool operator()(thread_t* thread, int priority) {
154     return body(thread, priority);
155   };
156 };
157 extern struct thread_set_rt_priority thread_set_rt_priority;
158 
159 // Name: thread_stop
160 // Params: thread_t* thread
161 // Return: void
162 struct thread_stop {
163   std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}};
operatorthread_stop164   void operator()(thread_t* thread) { body(thread); };
165 };
166 extern struct thread_stop thread_stop;
167 
168 }  // namespace osi_thread
169 }  // namespace mock
170 }  // namespace test
171 
172 // END mockcify generation
173