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 */) { return return_value; }}; operatorlist_contains98 bool operator()(const list_t* list, const void* data) { return body(list, data); } 99 }; 100 extern struct list_contains list_contains; 101 102 // Name: list_end 103 // Params: const list_t* list 104 // Return: list_node_t* 105 struct list_end { 106 list_node_t* return_value{0}; 107 std::function<list_node_t*(const list_t* list)> body{ 108 [this](const list_t* /* list */) { return return_value; }}; operatorlist_end109 list_node_t* operator()(const list_t* list) { return body(list); } 110 }; 111 extern struct list_end list_end; 112 113 // Name: list_foreach 114 // Params: const list_t* list, list_iter_cb callback, void* context 115 // Return: list_node_t* 116 struct list_foreach { 117 list_node_t* return_value{0}; 118 std::function<list_node_t*(const list_t* list, list_iter_cb callback, void* context)> body{ 119 [this](const list_t* /* list */, list_iter_cb /* callback */, void* /* context */) { 120 return return_value; 121 }}; operatorlist_foreach122 list_node_t* operator()(const list_t* list, list_iter_cb callback, void* context) { 123 return body(list, callback, context); 124 } 125 }; 126 extern struct list_foreach list_foreach; 127 128 // Name: list_free 129 // Params: list_t* list 130 // Return: void 131 struct list_free { 132 std::function<void(list_t* list)> body{[](list_t* /* list */) {}}; operatorlist_free133 void operator()(list_t* list) { body(list); } 134 }; 135 extern struct list_free list_free; 136 137 // Name: list_front 138 // Params: const list_t* list 139 // Return: void* 140 struct list_front { 141 void* return_value{}; 142 std::function<void*(const list_t* list)> body{ 143 [this](const list_t* /* list */) { return return_value; }}; operatorlist_front144 void* operator()(const list_t* list) { return body(list); } 145 }; 146 extern struct list_front list_front; 147 148 // Name: list_insert_after 149 // Params: list_t* list, list_node_t* prev_node, void* data 150 // Return: bool 151 struct list_insert_after { 152 bool return_value{false}; 153 std::function<bool(list_t* list, list_node_t* prev_node, void* data)> body{ 154 [this](list_t* /* list */, list_node_t* /* prev_node */, void* /* data */) { 155 return return_value; 156 }}; operatorlist_insert_after157 bool operator()(list_t* list, list_node_t* prev_node, void* data) { 158 return body(list, prev_node, data); 159 } 160 }; 161 extern struct list_insert_after list_insert_after; 162 163 // Name: list_is_empty 164 // Params: const list_t* list 165 // Return: bool 166 struct list_is_empty { 167 bool return_value{false}; 168 std::function<bool(const list_t* list)> body{ 169 [this](const list_t* /* list */) { return return_value; }}; operatorlist_is_empty170 bool operator()(const list_t* list) { return body(list); } 171 }; 172 extern struct list_is_empty list_is_empty; 173 174 // Name: list_length 175 // Params: const list_t* list 176 // Return: size_t 177 struct list_length { 178 size_t return_value{0}; 179 std::function<size_t(const list_t* list)> body{ 180 [this](const list_t* /* list */) { return return_value; }}; operatorlist_length181 size_t operator()(const list_t* list) { return body(list); } 182 }; 183 extern struct list_length list_length; 184 185 // Name: list_new 186 // Params: list_free_cb callback 187 // Return: list_t* 188 struct list_new { 189 list_t* return_value{0}; 190 std::function<list_t*(list_free_cb callback)> body{ 191 [this](list_free_cb /* callback */) { return return_value; }}; operatorlist_new192 list_t* operator()(list_free_cb callback) { return body(callback); } 193 }; 194 extern struct list_new list_new; 195 196 // Name: list_new_internal 197 // Params: list_free_cb callback, const allocator_t* zeroed_allocator 198 // Return: list_t* 199 struct list_new_internal { 200 list_t* return_value{0}; 201 std::function<list_t*(list_free_cb callback, const allocator_t* zeroed_allocator)> body{ 202 [this](list_free_cb /* callback */, const allocator_t* /* zeroed_allocator */) { 203 return return_value; 204 }}; operatorlist_new_internal205 list_t* operator()(list_free_cb callback, const allocator_t* zeroed_allocator) { 206 return body(callback, zeroed_allocator); 207 } 208 }; 209 extern struct list_new_internal list_new_internal; 210 211 // Name: list_next 212 // Params: const list_node_t* node 213 // Return: list_node_t* 214 struct list_next { 215 list_node_t* return_value{0}; 216 std::function<list_node_t*(const list_node_t* node)> body{ 217 [this](const list_node_t* /* node */) { return return_value; }}; operatorlist_next218 list_node_t* operator()(const list_node_t* node) { return body(node); } 219 }; 220 extern struct list_next list_next; 221 222 // Name: list_node 223 // Params: const list_node_t* node 224 // Return: void* 225 struct list_node { 226 void* return_value{}; 227 std::function<void*(const list_node_t* node)> body{ 228 [this](const list_node_t* /* node */) { return return_value; }}; operatorlist_node229 void* operator()(const list_node_t* node) { return body(node); } 230 }; 231 extern struct list_node list_node; 232 233 // Name: list_prepend 234 // Params: list_t* list, void* data 235 // Return: bool 236 struct list_prepend { 237 bool return_value{false}; 238 std::function<bool(list_t* list, void* data)> body{ 239 [this](list_t* /* list */, void* /* data */) { return return_value; }}; operatorlist_prepend240 bool operator()(list_t* list, void* data) { return body(list, data); } 241 }; 242 extern struct list_prepend list_prepend; 243 244 // Name: list_remove 245 // Params: list_t* list, void* data 246 // Return: bool 247 struct list_remove { 248 bool return_value{false}; 249 std::function<bool(list_t* list, void* data)> body{ 250 [this](list_t* /* list */, void* /* data */) { return return_value; }}; operatorlist_remove251 bool operator()(list_t* list, void* data) { return body(list, data); } 252 }; 253 extern struct list_remove list_remove; 254 255 } // namespace osi_list 256 } // namespace mock 257 } // namespace test 258 259 // END mockcify generation 260