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:19
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 
24 #include <functional>
25 
26 // Original included files, if any
27 
28 #include "osi/include/allocator.h"
29 #include "osi/include/list.h"
30 
31 // Mocked compile conditionals, if any
32 
33 namespace test {
34 namespace mock {
35 namespace osi_list {
36 
37 // Shared state between mocked functions and tests
38 // Name: list_append
39 // Params: list_t* list, void* data
40 // Return: bool
41 struct list_append {
42   bool return_value{false};
43   std::function<bool(list_t* list, void* data)> body{
44       [this](list_t* /* list */, void* /* data */) { return return_value; }};
operatorlist_append45   bool operator()(list_t* list, void* data) { return body(list, data); };
46 };
47 extern struct list_append list_append;
48 
49 // Name: list_back
50 // Params: const list_t* list
51 // Return: void*
52 struct list_back {
53   void* return_value{};
54   std::function<void*(const list_t* list)> body{
55       [this](const list_t* /* list */) { return return_value; }};
operatorlist_back56   void* operator()(const list_t* list) { return body(list); };
57 };
58 extern struct list_back list_back;
59 
60 // Name: list_back_node
61 // Params: const list_t* list
62 // Return: list_node_t*
63 struct list_back_node {
64   list_node_t* return_value{0};
65   std::function<list_node_t*(const list_t* list)> body{
66       [this](const list_t* /* list */) { return return_value; }};
operatorlist_back_node67   list_node_t* operator()(const list_t* list) { return body(list); };
68 };
69 extern struct list_back_node list_back_node;
70 
71 // Name: list_begin
72 // Params: const list_t* list
73 // Return: list_node_t*
74 struct list_begin {
75   list_node_t* return_value{0};
76   std::function<list_node_t*(const list_t* list)> body{
77       [this](const list_t* /* list */) { return return_value; }};
operatorlist_begin78   list_node_t* operator()(const list_t* list) { return body(list); };
79 };
80 extern struct list_begin list_begin;
81 
82 // Name: list_clear
83 // Params: list_t* list
84 // Return: void
85 struct list_clear {
86   std::function<void(list_t* list)> body{[](list_t* /* list */) {}};
operatorlist_clear87   void operator()(list_t* list) { body(list); };
88 };
89 extern struct list_clear list_clear;
90 
91 // Name: list_contains
92 // Params: const list_t* list, const void* data
93 // Return: bool
94 struct list_contains {
95   bool return_value{false};
96   std::function<bool(const list_t* list, const void* data)> body{
97       [this](const list_t* /* list */, const void* /* data */) {
98         return return_value;
99       }};
operatorlist_contains100   bool operator()(const list_t* list, const void* data) {
101     return body(list, data);
102   };
103 };
104 extern struct list_contains list_contains;
105 
106 // Name: list_end
107 // Params:  const list_t* list
108 // Return: list_node_t*
109 struct list_end {
110   list_node_t* return_value{0};
111   std::function<list_node_t*(const list_t* list)> body{
112       [this](const list_t* /* list */) { return return_value; }};
operatorlist_end113   list_node_t* operator()(const list_t* list) { return body(list); };
114 };
115 extern struct list_end list_end;
116 
117 // Name: list_foreach
118 // Params: const list_t* list, list_iter_cb callback, void* context
119 // Return: list_node_t*
120 struct list_foreach {
121   list_node_t* return_value{0};
122   std::function<list_node_t*(const list_t* list, list_iter_cb callback,
123                              void* context)>
124       body{[this](const list_t* /* list */, list_iter_cb /* callback */,
125                   void* /* context */) { return return_value; }};
operatorlist_foreach126   list_node_t* operator()(const list_t* list, list_iter_cb callback,
127                           void* context) {
128     return body(list, callback, context);
129   };
130 };
131 extern struct list_foreach list_foreach;
132 
133 // Name: list_free
134 // Params: list_t* list
135 // Return: void
136 struct list_free {
137   std::function<void(list_t* list)> body{[](list_t* /* list */) {}};
operatorlist_free138   void operator()(list_t* list) { body(list); };
139 };
140 extern struct list_free list_free;
141 
142 // Name: list_front
143 // Params: const list_t* list
144 // Return: void*
145 struct list_front {
146   void* return_value{};
147   std::function<void*(const list_t* list)> body{
148       [this](const list_t* /* list */) { return return_value; }};
operatorlist_front149   void* operator()(const list_t* list) { return body(list); };
150 };
151 extern struct list_front list_front;
152 
153 // Name: list_insert_after
154 // Params: list_t* list, list_node_t* prev_node, void* data
155 // Return: bool
156 struct list_insert_after {
157   bool return_value{false};
158   std::function<bool(list_t* list, list_node_t* prev_node, void* data)> body{
159       [this](list_t* /* list */, list_node_t* /* prev_node */,
160              void* /* data */) { return return_value; }};
operatorlist_insert_after161   bool operator()(list_t* list, list_node_t* prev_node, void* data) {
162     return body(list, prev_node, data);
163   };
164 };
165 extern struct list_insert_after list_insert_after;
166 
167 // Name: list_is_empty
168 // Params: const list_t* list
169 // Return: bool
170 struct list_is_empty {
171   bool return_value{false};
172   std::function<bool(const list_t* list)> body{
173       [this](const list_t* /* list */) { return return_value; }};
operatorlist_is_empty174   bool operator()(const list_t* list) { return body(list); };
175 };
176 extern struct list_is_empty list_is_empty;
177 
178 // Name: list_length
179 // Params: const list_t* list
180 // Return: size_t
181 struct list_length {
182   size_t return_value{0};
183   std::function<size_t(const list_t* list)> body{
184       [this](const list_t* /* list */) { return return_value; }};
operatorlist_length185   size_t operator()(const list_t* list) { return body(list); };
186 };
187 extern struct list_length list_length;
188 
189 // Name: list_new
190 // Params: list_free_cb callback
191 // Return: list_t*
192 struct list_new {
193   list_t* return_value{0};
194   std::function<list_t*(list_free_cb callback)> body{
195       [this](list_free_cb /* callback */) { return return_value; }};
operatorlist_new196   list_t* operator()(list_free_cb callback) { return body(callback); };
197 };
198 extern struct list_new list_new;
199 
200 // Name: list_new_internal
201 // Params: list_free_cb callback, const allocator_t* zeroed_allocator
202 // Return: list_t*
203 struct list_new_internal {
204   list_t* return_value{0};
205   std::function<list_t*(list_free_cb callback,
206                         const allocator_t* zeroed_allocator)>
207       body{[this](list_free_cb /* callback */,
208                   const allocator_t* /* zeroed_allocator */) {
209         return return_value;
210       }};
operatorlist_new_internal211   list_t* operator()(list_free_cb callback,
212                      const allocator_t* zeroed_allocator) {
213     return body(callback, zeroed_allocator);
214   };
215 };
216 extern struct list_new_internal list_new_internal;
217 
218 // Name: list_next
219 // Params: const list_node_t* node
220 // Return: list_node_t*
221 struct list_next {
222   list_node_t* return_value{0};
223   std::function<list_node_t*(const list_node_t* node)> body{
224       [this](const list_node_t* /* node */) { return return_value; }};
operatorlist_next225   list_node_t* operator()(const list_node_t* node) { return body(node); };
226 };
227 extern struct list_next list_next;
228 
229 // Name: list_node
230 // Params: const list_node_t* node
231 // Return: void*
232 struct list_node {
233   void* return_value{};
234   std::function<void*(const list_node_t* node)> body{
235       [this](const list_node_t* /* node */) { return return_value; }};
operatorlist_node236   void* operator()(const list_node_t* node) { return body(node); };
237 };
238 extern struct list_node list_node;
239 
240 // Name: list_prepend
241 // Params: list_t* list, void* data
242 // Return: bool
243 struct list_prepend {
244   bool return_value{false};
245   std::function<bool(list_t* list, void* data)> body{
246       [this](list_t* /* list */, void* /* data */) { return return_value; }};
operatorlist_prepend247   bool operator()(list_t* list, void* data) { return body(list, data); };
248 };
249 extern struct list_prepend list_prepend;
250 
251 // Name: list_remove
252 // Params: list_t* list, void* data
253 // Return: bool
254 struct list_remove {
255   bool return_value{false};
256   std::function<bool(list_t* list, void* data)> body{
257       [this](list_t* /* list */, void* /* data */) { return return_value; }};
operatorlist_remove258   bool operator()(list_t* list, void* data) { return body(list, data); };
259 };
260 extern struct list_remove list_remove;
261 
262 }  // namespace osi_list
263 }  // namespace mock
264 }  // namespace test
265 
266 // END mockcify generation
267