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:6 20 * 21 * mockcify.pl ver 0.3.0 22 */ 23 24 #include <functional> 25 26 // Original included files, if any 27 28 #include <stdlib.h> 29 #include <string.h> 30 31 // Mocked compile conditionals, if any 32 33 namespace test { 34 namespace mock { 35 namespace osi_allocator { 36 37 // Shared state between mocked functions and tests 38 // Name: osi_calloc 39 // Params: size_t size 40 // Return: void* 41 struct osi_calloc { 42 void* return_value{}; 43 std::function<void*(size_t size)> body{[this](size_t /* size */) { return return_value; }}; operatorosi_calloc44 void* operator()(size_t size) { return body(size); } 45 }; 46 extern struct osi_calloc osi_calloc; 47 48 // Name: osi_free 49 // Params: void* ptr 50 // Return: void 51 struct osi_free { 52 std::function<void(void* ptr)> body{[](void* /* ptr */) {}}; operatorosi_free53 void operator()(void* ptr) { body(ptr); } 54 }; 55 extern struct osi_free osi_free; 56 57 // Name: osi_free_and_reset 58 // Params: void** p_ptr 59 // Return: void 60 struct osi_free_and_reset { 61 std::function<void(void** p_ptr)> body{[](void** /* p_ptr */) {}}; operatorosi_free_and_reset62 void operator()(void** p_ptr) { body(p_ptr); } 63 }; 64 extern struct osi_free_and_reset osi_free_and_reset; 65 66 // Name: osi_malloc 67 // Params: size_t size 68 // Return: void* 69 struct osi_malloc { 70 void* return_value{}; 71 std::function<void*(size_t size)> body{[this](size_t /* size */) { return return_value; }}; operatorosi_malloc72 void* operator()(size_t size) { return body(size); } 73 }; 74 extern struct osi_malloc osi_malloc; 75 76 // Name: osi_strdup 77 // Params: const char* str 78 // Return: char* 79 struct osi_strdup { 80 char* return_value{0}; 81 std::function<char*(const char* str)> body{ 82 [this](const char* /* str */) { return return_value; }}; operatorosi_strdup83 char* operator()(const char* str) { return body(str); } 84 }; 85 extern struct osi_strdup osi_strdup; 86 87 // Name: osi_strndup 88 // Params: const char* str, size_t len 89 // Return: char* 90 struct osi_strndup { 91 char* return_value{0}; 92 std::function<char*(const char* str, size_t len)> body{ 93 [this](const char* /* str */, size_t /* len */) { return return_value; }}; operatorosi_strndup94 char* operator()(const char* str, size_t len) { return body(str, len); } 95 }; 96 extern struct osi_strndup osi_strndup; 97 98 } // namespace osi_allocator 99 } // namespace mock 100 } // namespace test 101 102 // END mockcify generation 103