• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cstdint>
25 #include <functional>
26 #include <map>
27 #include <string>
28 
29 extern std::map<std::string, int> mock_function_count_map;
30 
31 // Original included files, if any
32 // NOTE: Since this is a mock file with mock definitions some number of
33 //       include files may not be required.  The include-what-you-use
34 //       still applies, but crafting proper inclusion is out of scope
35 //       for this effort.  This compilation unit may compile as-is, or
36 //       may need attention to prune from (or add to ) the inclusion set.
37 #include <base/logging.h>
38 
39 #include "check.h"
40 #include "osi/include/allocator.h"
41 #include "osi/include/list.h"
42 #include "osi/include/osi.h"
43 
44 // Mocked compile conditionals, if any
45 
46 namespace test {
47 namespace mock {
48 namespace osi_list {
49 
50 // Shared state between mocked functions and tests
51 // Name: list_append
52 // Params: list_t* list, void* data
53 // Return: bool
54 struct list_append {
55   bool return_value{false};
56   std::function<bool(list_t* list, void* data)> body{
57       [this](list_t* list, void* data) { return return_value; }};
operatorlist_append58   bool operator()(list_t* list, void* data) { return body(list, data); };
59 };
60 extern struct list_append list_append;
61 
62 // Name: list_back
63 // Params: const list_t* list
64 // Return: void*
65 struct list_back {
66   void* return_value{};
67   std::function<void*(const list_t* list)> body{
68       [this](const list_t* list) { return return_value; }};
operatorlist_back69   void* operator()(const list_t* list) { return body(list); };
70 };
71 extern struct list_back list_back;
72 
73 // Name: list_back_node
74 // Params: const list_t* list
75 // Return: list_node_t*
76 struct list_back_node {
77   list_node_t* return_value{0};
78   std::function<list_node_t*(const list_t* list)> body{
79       [this](const list_t* list) { return return_value; }};
operatorlist_back_node80   list_node_t* operator()(const list_t* list) { return body(list); };
81 };
82 extern struct list_back_node list_back_node;
83 
84 // Name: list_begin
85 // Params: const list_t* list
86 // Return: list_node_t*
87 struct list_begin {
88   list_node_t* return_value{0};
89   std::function<list_node_t*(const list_t* list)> body{
90       [this](const list_t* list) { return return_value; }};
operatorlist_begin91   list_node_t* operator()(const list_t* list) { return body(list); };
92 };
93 extern struct list_begin list_begin;
94 
95 // Name: list_clear
96 // Params: list_t* list
97 // Return: void
98 struct list_clear {
99   std::function<void(list_t* list)> body{[](list_t* list) {}};
operatorlist_clear100   void operator()(list_t* list) { body(list); };
101 };
102 extern struct list_clear list_clear;
103 
104 // Name: list_contains
105 // Params: const list_t* list, const void* data
106 // Return: bool
107 struct list_contains {
108   bool return_value{false};
109   std::function<bool(const list_t* list, const void* data)> body{
110       [this](const list_t* list, const void* data) { return return_value; }};
operatorlist_contains111   bool operator()(const list_t* list, const void* data) {
112     return body(list, data);
113   };
114 };
115 extern struct list_contains list_contains;
116 
117 // Name: list_end
118 // Params:  const list_t* list
119 // Return: list_node_t*
120 struct list_end {
121   list_node_t* return_value{0};
122   std::function<list_node_t*(const list_t* list)> body{
123       [this](const list_t* list) { return return_value; }};
operatorlist_end124   list_node_t* operator()(const list_t* list) { return body(list); };
125 };
126 extern struct list_end list_end;
127 
128 // Name: list_foreach
129 // Params: const list_t* list, list_iter_cb callback, void* context
130 // Return: list_node_t*
131 struct list_foreach {
132   list_node_t* return_value{0};
133   std::function<list_node_t*(const list_t* list, list_iter_cb callback,
134                              void* context)>
135       body{[this](const list_t* list, list_iter_cb callback, void* context) {
136         return return_value;
137       }};
operatorlist_foreach138   list_node_t* operator()(const list_t* list, list_iter_cb callback,
139                           void* context) {
140     return body(list, callback, context);
141   };
142 };
143 extern struct list_foreach list_foreach;
144 
145 // Name: list_free
146 // Params: list_t* list
147 // Return: void
148 struct list_free {
149   std::function<void(list_t* list)> body{[](list_t* list) {}};
operatorlist_free150   void operator()(list_t* list) { body(list); };
151 };
152 extern struct list_free list_free;
153 
154 // Name: list_front
155 // Params: const list_t* list
156 // Return: void*
157 struct list_front {
158   void* return_value{};
159   std::function<void*(const list_t* list)> body{
160       [this](const list_t* list) { return return_value; }};
operatorlist_front161   void* operator()(const list_t* list) { return body(list); };
162 };
163 extern struct list_front list_front;
164 
165 // Name: list_insert_after
166 // Params: list_t* list, list_node_t* prev_node, void* data
167 // Return: bool
168 struct list_insert_after {
169   bool return_value{false};
170   std::function<bool(list_t* list, list_node_t* prev_node, void* data)> body{
171       [this](list_t* list, list_node_t* prev_node, void* data) {
172         return return_value;
173       }};
operatorlist_insert_after174   bool operator()(list_t* list, list_node_t* prev_node, void* data) {
175     return body(list, prev_node, data);
176   };
177 };
178 extern struct list_insert_after list_insert_after;
179 
180 // Name: list_is_empty
181 // Params: const list_t* list
182 // Return: bool
183 struct list_is_empty {
184   bool return_value{false};
185   std::function<bool(const list_t* list)> body{
186       [this](const list_t* list) { return return_value; }};
operatorlist_is_empty187   bool operator()(const list_t* list) { return body(list); };
188 };
189 extern struct list_is_empty list_is_empty;
190 
191 // Name: list_length
192 // Params: const list_t* list
193 // Return: size_t
194 struct list_length {
195   size_t return_value{0};
196   std::function<size_t(const list_t* list)> body{
197       [this](const list_t* list) { return return_value; }};
operatorlist_length198   size_t operator()(const list_t* list) { return body(list); };
199 };
200 extern struct list_length list_length;
201 
202 // Name: list_new
203 // Params: list_free_cb callback
204 // Return: list_t*
205 struct list_new {
206   list_t* return_value{0};
207   std::function<list_t*(list_free_cb callback)> body{
208       [this](list_free_cb callback) { return return_value; }};
operatorlist_new209   list_t* operator()(list_free_cb callback) { return body(callback); };
210 };
211 extern struct list_new list_new;
212 
213 // Name: list_new_internal
214 // Params: list_free_cb callback, const allocator_t* zeroed_allocator
215 // Return: list_t*
216 struct list_new_internal {
217   list_t* return_value{0};
218   std::function<list_t*(list_free_cb callback,
219                         const allocator_t* zeroed_allocator)>
220       body{[this](list_free_cb callback, const allocator_t* zeroed_allocator) {
221         return return_value;
222       }};
operatorlist_new_internal223   list_t* operator()(list_free_cb callback,
224                      const allocator_t* zeroed_allocator) {
225     return body(callback, zeroed_allocator);
226   };
227 };
228 extern struct list_new_internal list_new_internal;
229 
230 // Name: list_next
231 // Params: const list_node_t* node
232 // Return: list_node_t*
233 struct list_next {
234   list_node_t* return_value{0};
235   std::function<list_node_t*(const list_node_t* node)> body{
236       [this](const list_node_t* node) { return return_value; }};
operatorlist_next237   list_node_t* operator()(const list_node_t* node) { return body(node); };
238 };
239 extern struct list_next list_next;
240 
241 // Name: list_node
242 // Params: const list_node_t* node
243 // Return: void*
244 struct list_node {
245   void* return_value{};
246   std::function<void*(const list_node_t* node)> body{
247       [this](const list_node_t* node) { return return_value; }};
operatorlist_node248   void* operator()(const list_node_t* node) { return body(node); };
249 };
250 extern struct list_node list_node;
251 
252 // Name: list_prepend
253 // Params: list_t* list, void* data
254 // Return: bool
255 struct list_prepend {
256   bool return_value{false};
257   std::function<bool(list_t* list, void* data)> body{
258       [this](list_t* list, void* data) { return return_value; }};
operatorlist_prepend259   bool operator()(list_t* list, void* data) { return body(list, data); };
260 };
261 extern struct list_prepend list_prepend;
262 
263 // Name: list_remove
264 // Params: list_t* list, void* data
265 // Return: bool
266 struct list_remove {
267   bool return_value{false};
268   std::function<bool(list_t* list, void* data)> body{
269       [this](list_t* list, void* data) { return return_value; }};
operatorlist_remove270   bool operator()(list_t* list, void* data) { return body(list, data); };
271 };
272 extern struct list_remove list_remove;
273 
274 }  // namespace osi_list
275 }  // namespace mock
276 }  // namespace test
277 
278 // END mockcify generation