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 // Original included files, if any 30 // NOTE: Since this is a mock file with mock definitions some number of 31 // include files may not be required. The include-what-you-use 32 // still applies, but crafting proper inclusion is out of scope 33 // for this effort. This compilation unit may compile as-is, or 34 // may need attention to prune from (or add to ) the inclusion set. 35 #include <base/logging.h> 36 37 #include "check.h" 38 #include "osi/include/allocator.h" 39 #include "osi/include/list.h" 40 #include "osi/include/osi.h" 41 #include "test/common/mock_functions.h" 42 43 // Mocked compile conditionals, if any 44 45 namespace test { 46 namespace mock { 47 namespace osi_list { 48 49 // Shared state between mocked functions and tests 50 // Name: list_append 51 // Params: list_t* list, void* data 52 // Return: bool 53 struct list_append { 54 bool return_value{false}; 55 std::function<bool(list_t* list, void* data)> body{ 56 [this](list_t* list, void* data) { return return_value; }}; operatorlist_append57 bool operator()(list_t* list, void* data) { return body(list, data); }; 58 }; 59 extern struct list_append list_append; 60 61 // Name: list_back 62 // Params: const list_t* list 63 // Return: void* 64 struct list_back { 65 void* return_value{}; 66 std::function<void*(const list_t* list)> body{ 67 [this](const list_t* list) { return return_value; }}; operatorlist_back68 void* operator()(const list_t* list) { return body(list); }; 69 }; 70 extern struct list_back list_back; 71 72 // Name: list_back_node 73 // Params: const list_t* list 74 // Return: list_node_t* 75 struct list_back_node { 76 list_node_t* return_value{0}; 77 std::function<list_node_t*(const list_t* list)> body{ 78 [this](const list_t* list) { return return_value; }}; operatorlist_back_node79 list_node_t* operator()(const list_t* list) { return body(list); }; 80 }; 81 extern struct list_back_node list_back_node; 82 83 // Name: list_begin 84 // Params: const list_t* list 85 // Return: list_node_t* 86 struct list_begin { 87 list_node_t* return_value{0}; 88 std::function<list_node_t*(const list_t* list)> body{ 89 [this](const list_t* list) { return return_value; }}; operatorlist_begin90 list_node_t* operator()(const list_t* list) { return body(list); }; 91 }; 92 extern struct list_begin list_begin; 93 94 // Name: list_clear 95 // Params: list_t* list 96 // Return: void 97 struct list_clear { 98 std::function<void(list_t* list)> body{[](list_t* list) {}}; operatorlist_clear99 void operator()(list_t* list) { body(list); }; 100 }; 101 extern struct list_clear list_clear; 102 103 // Name: list_contains 104 // Params: const list_t* list, const void* data 105 // Return: bool 106 struct list_contains { 107 bool return_value{false}; 108 std::function<bool(const list_t* list, const void* data)> body{ 109 [this](const list_t* list, const void* data) { return return_value; }}; operatorlist_contains110 bool operator()(const list_t* list, const void* data) { 111 return body(list, data); 112 }; 113 }; 114 extern struct list_contains list_contains; 115 116 // Name: list_end 117 // Params: const list_t* list 118 // Return: list_node_t* 119 struct list_end { 120 list_node_t* return_value{0}; 121 std::function<list_node_t*(const list_t* list)> body{ 122 [this](const list_t* list) { return return_value; }}; operatorlist_end123 list_node_t* operator()(const list_t* list) { return body(list); }; 124 }; 125 extern struct list_end list_end; 126 127 // Name: list_foreach 128 // Params: const list_t* list, list_iter_cb callback, void* context 129 // Return: list_node_t* 130 struct list_foreach { 131 list_node_t* return_value{0}; 132 std::function<list_node_t*(const list_t* list, list_iter_cb callback, 133 void* context)> 134 body{[this](const list_t* list, list_iter_cb callback, void* context) { 135 return return_value; 136 }}; operatorlist_foreach137 list_node_t* operator()(const list_t* list, list_iter_cb callback, 138 void* context) { 139 return body(list, callback, context); 140 }; 141 }; 142 extern struct list_foreach list_foreach; 143 144 // Name: list_free 145 // Params: list_t* list 146 // Return: void 147 struct list_free { 148 std::function<void(list_t* list)> body{[](list_t* list) {}}; operatorlist_free149 void operator()(list_t* list) { body(list); }; 150 }; 151 extern struct list_free list_free; 152 153 // Name: list_front 154 // Params: const list_t* list 155 // Return: void* 156 struct list_front { 157 void* return_value{}; 158 std::function<void*(const list_t* list)> body{ 159 [this](const list_t* list) { return return_value; }}; operatorlist_front160 void* operator()(const list_t* list) { return body(list); }; 161 }; 162 extern struct list_front list_front; 163 164 // Name: list_insert_after 165 // Params: list_t* list, list_node_t* prev_node, void* data 166 // Return: bool 167 struct list_insert_after { 168 bool return_value{false}; 169 std::function<bool(list_t* list, list_node_t* prev_node, void* data)> body{ 170 [this](list_t* list, list_node_t* prev_node, void* data) { 171 return return_value; 172 }}; operatorlist_insert_after173 bool operator()(list_t* list, list_node_t* prev_node, void* data) { 174 return body(list, prev_node, data); 175 }; 176 }; 177 extern struct list_insert_after list_insert_after; 178 179 // Name: list_is_empty 180 // Params: const list_t* list 181 // Return: bool 182 struct list_is_empty { 183 bool return_value{false}; 184 std::function<bool(const list_t* list)> body{ 185 [this](const list_t* list) { return return_value; }}; operatorlist_is_empty186 bool operator()(const list_t* list) { return body(list); }; 187 }; 188 extern struct list_is_empty list_is_empty; 189 190 // Name: list_length 191 // Params: const list_t* list 192 // Return: size_t 193 struct list_length { 194 size_t return_value{0}; 195 std::function<size_t(const list_t* list)> body{ 196 [this](const list_t* list) { return return_value; }}; operatorlist_length197 size_t operator()(const list_t* list) { return body(list); }; 198 }; 199 extern struct list_length list_length; 200 201 // Name: list_new 202 // Params: list_free_cb callback 203 // Return: list_t* 204 struct list_new { 205 list_t* return_value{0}; 206 std::function<list_t*(list_free_cb callback)> body{ 207 [this](list_free_cb callback) { return return_value; }}; operatorlist_new208 list_t* operator()(list_free_cb callback) { return body(callback); }; 209 }; 210 extern struct list_new list_new; 211 212 // Name: list_new_internal 213 // Params: list_free_cb callback, const allocator_t* zeroed_allocator 214 // Return: list_t* 215 struct list_new_internal { 216 list_t* return_value{0}; 217 std::function<list_t*(list_free_cb callback, 218 const allocator_t* zeroed_allocator)> 219 body{[this](list_free_cb callback, const allocator_t* zeroed_allocator) { 220 return return_value; 221 }}; operatorlist_new_internal222 list_t* operator()(list_free_cb callback, 223 const allocator_t* zeroed_allocator) { 224 return body(callback, zeroed_allocator); 225 }; 226 }; 227 extern struct list_new_internal list_new_internal; 228 229 // Name: list_next 230 // Params: const list_node_t* node 231 // Return: list_node_t* 232 struct list_next { 233 list_node_t* return_value{0}; 234 std::function<list_node_t*(const list_node_t* node)> body{ 235 [this](const list_node_t* node) { return return_value; }}; operatorlist_next236 list_node_t* operator()(const list_node_t* node) { return body(node); }; 237 }; 238 extern struct list_next list_next; 239 240 // Name: list_node 241 // Params: const list_node_t* node 242 // Return: void* 243 struct list_node { 244 void* return_value{}; 245 std::function<void*(const list_node_t* node)> body{ 246 [this](const list_node_t* node) { return return_value; }}; operatorlist_node247 void* operator()(const list_node_t* node) { return body(node); }; 248 }; 249 extern struct list_node list_node; 250 251 // Name: list_prepend 252 // Params: list_t* list, void* data 253 // Return: bool 254 struct list_prepend { 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_prepend258 bool operator()(list_t* list, void* data) { return body(list, data); }; 259 }; 260 extern struct list_prepend list_prepend; 261 262 // Name: list_remove 263 // Params: list_t* list, void* data 264 // Return: bool 265 struct list_remove { 266 bool return_value{false}; 267 std::function<bool(list_t* list, void* data)> body{ 268 [this](list_t* list, void* data) { return return_value; }}; operatorlist_remove269 bool operator()(list_t* list, void* data) { return body(list, data); }; 270 }; 271 extern struct list_remove list_remove; 272 273 } // namespace osi_list 274 } // namespace mock 275 } // namespace test 276 277 // END mockcify generation