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:8
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 
24 #include <cstdint>
25 #include <functional>
26 
27 // Original included files, if any
28 
29 #include <stdlib.h>
30 
31 #include "osi/include/ringbuffer.h"
32 
33 // Mocked compile conditionals, if any
34 
35 namespace test {
36 namespace mock {
37 namespace osi_ringbuffer {
38 
39 // Shared state between mocked functions and tests
40 // Name: ringbuffer_available
41 // Params: const ringbuffer_t* rb
42 // Return: size_t
43 struct ringbuffer_available {
44   size_t return_value{0};
45   std::function<size_t(const ringbuffer_t* rb)> body{
46       [this](const ringbuffer_t* /* rb */) { return return_value; }};
operatorringbuffer_available47   size_t operator()(const ringbuffer_t* rb) { return body(rb); };
48 };
49 extern struct ringbuffer_available ringbuffer_available;
50 
51 // Name: ringbuffer_delete
52 // Params: ringbuffer_t* rb, size_t length
53 // Return: size_t
54 struct ringbuffer_delete {
55   size_t return_value{0};
56   std::function<size_t(ringbuffer_t* rb, size_t length)> body{
57       [this](ringbuffer_t* /* rb */, size_t /* length */) {
58         return return_value;
59       }};
operatorringbuffer_delete60   size_t operator()(ringbuffer_t* rb, size_t length) {
61     return body(rb, length);
62   };
63 };
64 extern struct ringbuffer_delete ringbuffer_delete;
65 
66 // Name: ringbuffer_free
67 // Params: ringbuffer_t* rb
68 // Return: void
69 struct ringbuffer_free {
70   std::function<void(ringbuffer_t* rb)> body{[](ringbuffer_t* /* rb */) {}};
operatorringbuffer_free71   void operator()(ringbuffer_t* rb) { body(rb); };
72 };
73 extern struct ringbuffer_free ringbuffer_free;
74 
75 // Name: ringbuffer_init
76 // Params: const size_t size
77 // Return: ringbuffer_t*
78 struct ringbuffer_init {
79   ringbuffer_t* return_value{0};
80   std::function<ringbuffer_t*(const size_t size)> body{
81       [this](const size_t /* size */) { return return_value; }};
operatorringbuffer_init82   ringbuffer_t* operator()(const size_t size) { return body(size); };
83 };
84 extern struct ringbuffer_init ringbuffer_init;
85 
86 // Name: ringbuffer_insert
87 // Params: ringbuffer_t* rb, const uint8_t* p, size_t length
88 // Return: size_t
89 struct ringbuffer_insert {
90   size_t return_value{0};
91   std::function<size_t(ringbuffer_t* rb, const uint8_t* p, size_t length)> body{
92       [this](ringbuffer_t* /* rb */, const uint8_t* /* p */,
93              size_t /* length */) { return return_value; }};
operatorringbuffer_insert94   size_t operator()(ringbuffer_t* rb, const uint8_t* p, size_t length) {
95     return body(rb, p, length);
96   };
97 };
98 extern struct ringbuffer_insert ringbuffer_insert;
99 
100 // Name: ringbuffer_peek
101 // Params: const ringbuffer_t* rb, off_t offset, uint8_t* p, size_t length
102 // Return: size_t
103 struct ringbuffer_peek {
104   size_t return_value{0};
105   std::function<size_t(const ringbuffer_t* rb, off_t offset, uint8_t* p,
106                        size_t length)>
107       body{[this](const ringbuffer_t* /* rb */, off_t /* offset */,
108                   uint8_t* /* p */,
109                   size_t /* length */) { return return_value; }};
operatorringbuffer_peek110   size_t operator()(const ringbuffer_t* rb, off_t offset, uint8_t* p,
111                     size_t length) {
112     return body(rb, offset, p, length);
113   };
114 };
115 extern struct ringbuffer_peek ringbuffer_peek;
116 
117 // Name: ringbuffer_pop
118 // Params: ringbuffer_t* rb, uint8_t* p, size_t length
119 // Return: size_t
120 struct ringbuffer_pop {
121   size_t return_value{0};
122   std::function<size_t(ringbuffer_t* rb, uint8_t* p, size_t length)> body{
123       [this](ringbuffer_t* /* rb */, uint8_t* /* p */, size_t /* length */) {
124         return return_value;
125       }};
operatorringbuffer_pop126   size_t operator()(ringbuffer_t* rb, uint8_t* p, size_t length) {
127     return body(rb, p, length);
128   };
129 };
130 extern struct ringbuffer_pop ringbuffer_pop;
131 
132 // Name: ringbuffer_size
133 // Params: const ringbuffer_t* rb
134 // Return: size_t
135 struct ringbuffer_size {
136   size_t return_value{0};
137   std::function<size_t(const ringbuffer_t* rb)> body{
138       [this](const ringbuffer_t* /* rb */) { return return_value; }};
operatorringbuffer_size139   size_t operator()(const ringbuffer_t* rb) { return body(rb); };
140 };
141 extern struct ringbuffer_size ringbuffer_size;
142 
143 }  // namespace osi_ringbuffer
144 }  // namespace mock
145 }  // namespace test
146 
147 // END mockcify generation
148