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{
44       [this](size_t /* size */) { return return_value; }};
operatorosi_calloc45   void* operator()(size_t size) { return body(size); };
46 };
47 extern struct osi_calloc osi_calloc;
48 
49 // Name: osi_free
50 // Params: void* ptr
51 // Return: void
52 struct osi_free {
53   std::function<void(void* ptr)> body{[](void* /* ptr */) {}};
operatorosi_free54   void operator()(void* ptr) { body(ptr); };
55 };
56 extern struct osi_free osi_free;
57 
58 // Name: osi_free_and_reset
59 // Params: void** p_ptr
60 // Return: void
61 struct osi_free_and_reset {
62   std::function<void(void** p_ptr)> body{[](void** /* p_ptr */) {}};
operatorosi_free_and_reset63   void operator()(void** p_ptr) { body(p_ptr); };
64 };
65 extern struct osi_free_and_reset osi_free_and_reset;
66 
67 // Name: osi_malloc
68 // Params: size_t size
69 // Return: void*
70 struct osi_malloc {
71   void* return_value{};
72   std::function<void*(size_t size)> body{
73       [this](size_t /* size */) { return return_value; }};
operatorosi_malloc74   void* operator()(size_t size) { return body(size); };
75 };
76 extern struct osi_malloc osi_malloc;
77 
78 // Name: osi_strdup
79 // Params: const char* str
80 // Return: char*
81 struct osi_strdup {
82   char* return_value{0};
83   std::function<char*(const char* str)> body{
84       [this](const char* /* str */) { return return_value; }};
operatorosi_strdup85   char* operator()(const char* str) { return body(str); };
86 };
87 extern struct osi_strdup osi_strdup;
88 
89 // Name: osi_strndup
90 // Params: const char* str, size_t len
91 // Return: char*
92 struct osi_strndup {
93   char* return_value{0};
94   std::function<char*(const char* str, size_t len)> body{
95       [this](const char* /* str */, size_t /* len */) { return return_value; }};
operatorosi_strndup96   char* operator()(const char* str, size_t len) { return body(str, len); };
97 };
98 extern struct osi_strndup osi_strndup;
99 
100 }  // namespace osi_allocator
101 }  // namespace mock
102 }  // namespace test
103 
104 // END mockcify generation
105