• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:24
20  *
21  *  mockcify.pl ver 0.3.0
22  */
23 
24 #include <cstdint>
25 #include <functional>
26 #include <string>
27 
28 // Original included files, if any
29 #include <base/files/file_util.h>
30 #include <fcntl.h>
31 #include <libgen.h>
32 #include <stdlib.h>
33 #include <sys/stat.h>
34 #include <unistd.h>
35 
36 #include "osi/include/config.h"
37 
38 // Mocked compile conditionals, if any
39 
40 namespace test {
41 namespace mock {
42 namespace osi_config {
43 
44 // Shared state between mocked functions and tests
45 // Name: checksum_read
46 // Params: const char* filename
47 // Return: std::string
48 struct checksum_read {
49   std::string return_value{std::string()};
50   std::function<std::string(const char* filename)> body{
51       [this](const char* /* filename */) { return return_value; }};
operatorchecksum_read52   std::string operator()(const char* filename) { return body(filename); };
53 };
54 extern struct checksum_read checksum_read;
55 
56 // Name: checksum_save
57 // Params: const std::string& checksum, const std::string& filename
58 // Return: bool
59 struct checksum_save {
60   bool return_value{false};
61   std::function<bool(const std::string& checksum, const std::string& filename)>
62       body{[this](const std::string& /* checksum */,
63                   const std::string& /* filename */) { return return_value; }};
operatorchecksum_save64   bool operator()(const std::string& checksum, const std::string& filename) {
65     return body(checksum, filename);
66   };
67 };
68 extern struct checksum_save checksum_save;
69 
70 // Name: config_get_bool
71 // Params: const config_t& config, const std::string& section, const
72 // std::string& key, bool def_value Return: bool
73 struct config_get_bool {
74   bool return_value{false};
75   std::function<bool(const config_t& config, const std::string& section,
76                      const std::string& key, bool def_value)>
77       body{[this](const config_t& /* config */,
78                   const std::string& /* section */,
79                   const std::string& /* key */,
80                   bool /* def_value */) { return return_value; }};
operatorconfig_get_bool81   bool operator()(const config_t& config, const std::string& section,
82                   const std::string& key, bool def_value) {
83     return body(config, section, key, def_value);
84   };
85 };
86 extern struct config_get_bool config_get_bool;
87 
88 // Name: config_get_int
89 // Params: const config_t& config, const std::string& section, const
90 // std::string& key, int def_value Return: int
91 struct config_get_int {
92   int return_value{0};
93   std::function<int(const config_t& config, const std::string& section,
94                     const std::string& key, int def_value)>
95       body{[this](const config_t& /* config */,
96                   const std::string& /* section */,
97                   const std::string& /* key */,
98                   int /* def_value */) { return return_value; }};
operatorconfig_get_int99   int operator()(const config_t& config, const std::string& section,
100                  const std::string& key, int def_value) {
101     return body(config, section, key, def_value);
102   };
103 };
104 extern struct config_get_int config_get_int;
105 
106 // Name: config_get_string
107 // Params: const config_t& config, const std::string& section, const
108 // std::string& key, const std::string* def_value Return: const std::string*
109 struct config_get_string {
110   const std::string* return_value{0};
111   std::function<const std::string*(
112       const config_t& config, const std::string& section,
113       const std::string& key, const std::string* def_value)>
114       body{[this](const config_t& /* config */,
115                   const std::string& /* section */,
116                   const std::string& /* key */,
117                   const std::string* /* def_value */) { return return_value; }};
operatorconfig_get_string118   const std::string* operator()(const config_t& config,
119                                 const std::string& section,
120                                 const std::string& key,
121                                 const std::string* def_value) {
122     return body(config, section, key, def_value);
123   };
124 };
125 extern struct config_get_string config_get_string;
126 
127 // Name: config_get_uint64
128 // Params: const config_t& config, const std::string& section, const
129 // std::string& key, uint64_t def_value Return: uint64_t
130 struct config_get_uint64 {
131   uint64_t return_value{0};
132   std::function<uint64_t(const config_t& config, const std::string& section,
133                          const std::string& key, uint64_t def_value)>
134       body{[this](const config_t& /* config */,
135                   const std::string& /* section */,
136                   const std::string& /* key */,
137                   uint64_t /* def_value */) { return return_value; }};
operatorconfig_get_uint64138   uint64_t operator()(const config_t& config, const std::string& section,
139                       const std::string& key, uint64_t def_value) {
140     return body(config, section, key, def_value);
141   };
142 };
143 extern struct config_get_uint64 config_get_uint64;
144 
145 // Name: config_has_key
146 // Params: const config_t& config, const std::string& section, const
147 // std::string& key Return: bool
148 struct config_has_key {
149   bool return_value{false};
150   std::function<bool(const config_t& config, const std::string& section,
151                      const std::string& key)>
152       body{[this](const config_t& /* config */,
153                   const std::string& /* section */,
154                   const std::string& /* key */) { return return_value; }};
operatorconfig_has_key155   bool operator()(const config_t& config, const std::string& section,
156                   const std::string& key) {
157     return body(config, section, key);
158   };
159 };
160 extern struct config_has_key config_has_key;
161 
162 // Name: config_has_section
163 // Params: const config_t& config, const std::string& section
164 // Return: bool
165 struct config_has_section {
166   bool return_value{false};
167   std::function<bool(const config_t& /* config */,
168                      const std::string& /* section */)>
169       body{[this](const config_t& /* config */,
170                   const std::string& /* section */) { return return_value; }};
operatorconfig_has_section171   bool operator()(const config_t& config, const std::string& section) {
172     return body(config, section);
173   };
174 };
175 extern struct config_has_section config_has_section;
176 
177 // Name: config_new
178 // Params: const char* filename
179 // Return: std::unique_ptr<config_t>
180 struct config_new {
181   std::function<std::unique_ptr<config_t>(const char* filename)> body{
182       [](const char* /* filename */) { return std::make_unique<config_t>(); }};
operatorconfig_new183   std::unique_ptr<config_t> operator()(const char* filename) {
184     return body(filename);
185   };
186 };
187 extern struct config_new config_new;
188 
189 // Name: config_new_clone
190 // Params: const config_t& src
191 // Return: std::unique_ptr<config_t>
192 struct config_new_clone {
193   std::function<std::unique_ptr<config_t>(const config_t& src)> body{
194       [](const config_t& /* src */) { return std::make_unique<config_t>(); }};
operatorconfig_new_clone195   std::unique_ptr<config_t> operator()(const config_t& src) {
196     return body(src);
197   };
198 };
199 extern struct config_new_clone config_new_clone;
200 
201 // Name: config_new_empty
202 // Params: void
203 // Return: std::unique_ptr<config_t>
204 struct config_new_empty {
205   std::function<std::unique_ptr<config_t>(void)> body{
206       [](void) { return std::make_unique<config_t>(); }};
operatorconfig_new_empty207   std::unique_ptr<config_t> operator()(void) { return body(); };
208 };
209 extern struct config_new_empty config_new_empty;
210 
211 // Name: config_remove_key
212 // Params: config_t* config, const std::string& section, const std::string& key
213 // Return: bool
214 struct config_remove_key {
215   bool return_value{false};
216   std::function<bool(config_t* config, const std::string& section,
217                      const std::string& key)>
218       body{[this](config_t* /* config */, const std::string& /* section */,
219                   const std::string& /* key */) { return return_value; }};
operatorconfig_remove_key220   bool operator()(config_t* config, const std::string& section,
221                   const std::string& key) {
222     return body(config, section, key);
223   };
224 };
225 extern struct config_remove_key config_remove_key;
226 
227 // Name: config_remove_section
228 // Params: config_t* config, const std::string& section
229 // Return: bool
230 struct config_remove_section {
231   bool return_value{false};
232   std::function<bool(config_t* config, const std::string& section)> body{
233       [this](config_t* /* config */, const std::string& /* section */) {
234         return return_value;
235       }};
operatorconfig_remove_section236   bool operator()(config_t* config, const std::string& section) {
237     return body(config, section);
238   };
239 };
240 extern struct config_remove_section config_remove_section;
241 
242 // Name: config_save
243 // Params: const config_t& config, const std::string& filename
244 // Return: bool
245 struct config_save {
246   bool return_value{false};
247   std::function<bool(const config_t& config, const std::string& filename)> body{
248       [this](const config_t& /* config */, const std::string& /* filename */) {
249         return return_value;
250       }};
operatorconfig_save251   bool operator()(const config_t& config, const std::string& filename) {
252     return body(config, filename);
253   };
254 };
255 extern struct config_save config_save;
256 
257 // Name: config_set_bool
258 // Params: config_t* config, const std::string& section, const std::string& key,
259 // bool value Return: void
260 struct config_set_bool {
261   std::function<void(config_t* config, const std::string& section,
262                      const std::string& key, bool value)>
263       body{[](config_t* /* config */, const std::string& /* section */,
264               const std::string& /* key */, bool /* value */) {}};
operatorconfig_set_bool265   void operator()(config_t* config, const std::string& section,
266                   const std::string& key, bool value) {
267     body(config, section, key, value);
268   };
269 };
270 extern struct config_set_bool config_set_bool;
271 
272 // Name: config_set_int
273 // Params: config_t* config, const std::string& section, const std::string& key,
274 // int value Return: void
275 struct config_set_int {
276   std::function<void(config_t* config, const std::string& section,
277                      const std::string& key, int value)>
278       body{[](config_t* /* config */, const std::string& /* section */,
279               const std::string& /* key */, int /* value */) {}};
operatorconfig_set_int280   void operator()(config_t* config, const std::string& section,
281                   const std::string& key, int value) {
282     body(config, section, key, value);
283   };
284 };
285 extern struct config_set_int config_set_int;
286 
287 // Name: config_set_string
288 // Params: config_t* config, const std::string& section, const std::string& key,
289 // const std::string& value Return: void
290 struct config_set_string {
291   std::function<void(config_t* config, const std::string& section,
292                      const std::string& key, const std::string& value)>
293       body{[](config_t* /* config */, const std::string& /* section */,
294               const std::string& /* key */, const std::string& /* value */) {}};
operatorconfig_set_string295   void operator()(config_t* config, const std::string& section,
296                   const std::string& key, const std::string& value) {
297     body(config, section, key, value);
298   };
299 };
300 extern struct config_set_string config_set_string;
301 
302 // Name: config_set_uint64
303 // Params: config_t* config, const std::string& section, const std::string& key,
304 // uint64_t value Return: void
305 struct config_set_uint64 {
306   std::function<void(config_t* config, const std::string& section,
307                      const std::string& key, uint64_t value)>
308       body{[](config_t* /* config */, const std::string& /* section */,
309               const std::string& /* key */, uint64_t /* value */) {}};
operatorconfig_set_uint64310   void operator()(config_t* config, const std::string& section,
311                   const std::string& key, uint64_t value) {
312     body(config, section, key, value);
313   };
314 };
315 extern struct config_set_uint64 config_set_uint64;
316 
317 // Name: config_t::Find
318 // Params: const std::string& section
319 // Return: std::list<section_t>::iterator
320 struct config_t_Find {
321   std::list<section_t> section_;
322   std::function<std::list<section_t>::iterator(const std::string& section)>
323       body{[this](const std::string& /* section */) {
324         return section_.begin();
325       }};
operatorconfig_t_Find326   std::list<section_t>::iterator operator()(const std::string& section) {
327     return body(section);
328   };
329 };
330 extern struct config_t_Find config_t_Find;
331 
332 // Name: config_t_Has
333 // Params: const std::string& key
334 // Return: bool
335 struct config_t_Has {
336   bool return_value{false};
337   std::function<bool(const std::string& key)> body{
338       [this](const std::string& /* key */) { return return_value; }};
operatorconfig_t_Has339   bool operator()(const std::string& key) { return body(key); };
340 };
341 extern struct config_t_Has config_t_Has;
342 
343 // Name: section_t_Find
344 // Params: const std::string& key
345 // Return: std::list<entry_t>::iterator
346 struct section_t_Find {
347   std::list<entry_t> list_;
348   std::function<std::list<entry_t>::iterator(const std::string& key)> body{
349       [this](const std::string& /* key */) { return list_.begin(); }};
operatorsection_t_Find350   std::list<entry_t>::iterator operator()(const std::string& key) {
351     return body(key);
352   };
353 };
354 extern struct section_t_Find section_t_Find;
355 
356 // Name: section_t_Has
357 // Params: const std::string& key
358 // Return: bool
359 struct section_t_Has {
360   bool return_value{false};
361   std::function<bool(const std::string& key)> body{
362       [this](const std::string& /* key */) { return return_value; }};
operatorsection_t_Has363   bool operator()(const std::string& key) { return body(key); };
364 };
365 extern struct section_t_Has section_t_Has;
366 
367 // Name: section_t_Set
368 // Params: std::string key, std::string value
369 // Return: void
370 struct section_t_Set {
371   std::function<void(std::string key, std::string value)> body{
372       [](std::string /* key */, std::string /* value */) {}};
operatorsection_t_Set373   void operator()(std::string key, std::string value) { body(key, value); };
374 };
375 extern struct section_t_Set section_t_Set;
376 
377 }  // namespace osi_config
378 }  // namespace mock
379 }  // namespace test
380 
381 // END mockcify generation
382