• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 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 namespace test {
18 namespace mock {
19 namespace device_iot_config {
20 
21 // Shared state between mocked functions and tests
22 // Name: device_iot_config_get_int
23 // Params: const std::string& section, const std::string& key, int& value
24 // Return: bool
25 struct device_iot_config_get_int {
26   bool return_value{false};
27   std::function<bool(const std::string& section, const std::string& key,
28                      int& value)>
29       body{[this](const std::string& section, const std::string& key,
30                   int& value) { return return_value; }};
operatordevice_iot_config_get_int31   bool operator()(const std::string& section, const std::string& key,
32                   int& value) {
33     return body(section, key, value);
34   };
35 };
36 extern struct device_iot_config_get_int device_iot_config_get_int;
37 
38 // Name: device_iot_config_set_int
39 // Params: const std::string& section, const std::string& key, int& value
40 // Return: bool
41 struct device_iot_config_set_int {
42   bool return_value{false};
43   std::function<bool(const std::string& section, const std::string& key,
44                      int value)>
45       body{[this](const std::string& section, const std::string& key,
46                   int value) { return return_value; }};
operatordevice_iot_config_set_int47   bool operator()(const std::string& section, const std::string& key,
48                   int value) {
49     return body(section, key, value);
50   };
51 };
52 extern struct device_iot_config_set_int device_iot_config_set_int;
53 
54 // Name: device_iot_config_int_add_one
55 // Params: const std::string& section, const std::string& key
56 // Return: bool
57 struct device_iot_config_int_add_one {
58   bool return_value{false};
59   std::function<bool(const std::string& section, const std::string& key)> body{
60       [this](const std::string& section, const std::string& key) {
61         return return_value;
62       }};
operatordevice_iot_config_int_add_one63   bool operator()(const std::string& section, const std::string& key) {
64     return body(section, key);
65   };
66 };
67 extern struct device_iot_config_int_add_one device_iot_config_int_add_one;
68 
69 // Name: device_iot_config_get_hex
70 // Params: const std::string& section, const std::string& key, int& value
71 // Return: bool
72 struct device_iot_config_get_hex {
73   bool return_value{false};
74   std::function<bool(const std::string& section, const std::string& key,
75                      int& value)>
76       body{[this](const std::string& section, const std::string& key,
77                   int& value) { return return_value; }};
operatordevice_iot_config_get_hex78   bool operator()(const std::string& section, const std::string& key,
79                   int& value) {
80     return body(section, key, value);
81   };
82 };
83 extern struct device_iot_config_get_hex device_iot_config_get_hex;
84 
85 // Name: device_iot_config_set_hex
86 // Params: const std::string& section, const std::string& key, int value, int
87 // byte_num
88 // Return: bool
89 struct device_iot_config_set_hex {
90   bool return_value{false};
91   std::function<bool(const std::string& section, const std::string& key,
92                      int value, int byte_num)>
93       body{[this](const std::string& section, const std::string& key, int value,
94                   int byte_num) { return return_value; }};
operatordevice_iot_config_set_hex95   bool operator()(const std::string& section, const std::string& key, int value,
96                   int byte_num) {
97     return body(section, key, value, byte_num);
98   };
99 };
100 extern struct device_iot_config_set_hex device_iot_config_set_hex;
101 
102 // Name: device_iot_config_set_hex_if_greater
103 // Params: const std::string& section, const std::string& key, int value, int
104 // byte_num
105 // Return: bool
106 struct device_iot_config_set_hex_if_greater {
107   bool return_value{false};
108   std::function<bool(const std::string& section, const std::string& key,
109                      int value, int byte_num)>
110       body{[this](const std::string& section, const std::string& key, int value,
111                   int byte_num) { return return_value; }};
operatordevice_iot_config_set_hex_if_greater112   bool operator()(const std::string& section, const std::string& key, int value,
113                   int byte_num) {
114     return body(section, key, value, byte_num);
115   };
116 };
117 extern struct device_iot_config_set_hex_if_greater
118     device_iot_config_set_hex_if_greater;
119 
120 // Name: device_iot_config_get_str
121 // Params: const std::string& section, const std::string& key, char* value, int*
122 // size_bytes
123 // Return: bool
124 struct device_iot_config_get_str {
125   bool return_value{false};
126   std::function<bool(const std::string& section, const std::string& key,
127                      char* value, int* size_bytes)>
128       body{[this](const std::string& section, const std::string& key,
129                   char* value, int* size_bytes) { return return_value; }};
operatordevice_iot_config_get_str130   bool operator()(const std::string& section, const std::string& key,
131                   char* value, int* size_bytes) {
132     return body(section, key, value, size_bytes);
133   };
134 };
135 extern struct device_iot_config_get_str device_iot_config_get_str;
136 
137 // Name: device_iot_config_set_str
138 // Params: const std::string& section, const std::string& key, const
139 // std::string& value
140 // Return: bool
141 struct device_iot_config_set_str {
142   bool return_value{false};
143   std::function<bool(const std::string& section, const std::string& key,
144                      const std::string& value)>
145       body{[this](const std::string& section, const std::string& key,
146                   const std::string& value) { return return_value; }};
operatordevice_iot_config_set_str147   bool operator()(const std::string& section, const std::string& key,
148                   const std::string& value) {
149     return body(section, key, value);
150   };
151 };
152 extern struct device_iot_config_set_str device_iot_config_set_str;
153 
154 // Name: device_iot_config_get_bin
155 // Params: const std::string& section, const std::string& key, uint8_t* value,
156 // size_t* length
157 // Return: bool
158 struct device_iot_config_get_bin {
159   bool return_value{false};
160   std::function<bool(const std::string& section, const std::string& key,
161                      uint8_t* value, size_t* length)>
162       body{[this](const std::string& section, const std::string& key,
163                   uint8_t* value, size_t* length) { return return_value; }};
operatordevice_iot_config_get_bin164   bool operator()(const std::string& section, const std::string& key,
165                   uint8_t* value, size_t* length) {
166     return body(section, key, value, length);
167   };
168 };
169 extern struct device_iot_config_get_bin device_iot_config_get_bin;
170 
171 // Name: device_iot_config_set_bin
172 // Params: const std::string& section, const std::string& key, const uint8_t*
173 // value, size_t length
174 // Return: bool
175 struct device_iot_config_set_bin {
176   bool return_value{false};
177   std::function<bool(const std::string& section, const std::string& key,
178                      const uint8_t* value, size_t length)>
179       body{[this](const std::string& section, const std::string& key,
180                   const uint8_t* value,
181                   size_t length) { return return_value; }};
operatordevice_iot_config_set_bin182   bool operator()(const std::string& section, const std::string& key,
183                   const uint8_t* value, size_t length) {
184     return body(section, key, value, length);
185   };
186 };
187 extern struct device_iot_config_set_bin device_iot_config_set_bin;
188 
189 // Name: device_iot_config_get_bin_length
190 // Params: const std::string& section, const std::string& key
191 // Return: size_t
192 struct device_iot_config_get_bin_length {
193   size_t return_value{0};
194   std::function<size_t(const std::string& section, const std::string& key)>
195       body{[this](const std::string& section, const std::string& key) {
196         return return_value;
197       }};
operatordevice_iot_config_get_bin_length198   size_t operator()(const std::string& section, const std::string& key) {
199     return body(section, key);
200   };
201 };
202 extern struct device_iot_config_get_bin_length device_iot_config_get_bin_length;
203 
204 // Name: device_iot_config_has_section
205 // Params: const std::string& section
206 // Return: bool
207 struct device_iot_config_has_section {
208   bool return_value{false};
209   std::function<bool(const std::string& section)> body{
210       [this](const std::string& section) { return return_value; }};
operatordevice_iot_config_has_section211   bool operator()(const std::string& section) { return body(section); };
212 };
213 extern struct device_iot_config_has_section device_iot_config_has_section;
214 
215 // Name: device_iot_config_exist
216 // Params: const std::string& section, const std::string& key
217 // Return: bool
218 struct device_iot_config_exist {
219   bool return_value{false};
220   std::function<bool(const std::string& section, const std::string& key)> body{
221       [this](const std::string& section, const std::string& key) {
222         return return_value;
223       }};
operatordevice_iot_config_exist224   bool operator()(const std::string& section, const std::string& key) {
225     return body(section, key);
226   };
227 };
228 extern struct device_iot_config_exist device_iot_config_exist;
229 
230 // Name: device_iot_config_remove
231 // Params: const std::string& section, const std::string& key
232 // Return: bool
233 struct device_iot_config_remove {
234   bool return_value{false};
235   std::function<bool(const std::string& section, const std::string& key)> body{
236       [this](const std::string& section, const std::string& key) {
237         return return_value;
238       }};
operatordevice_iot_config_remove239   bool operator()(const std::string& section, const std::string& key) {
240     return body(section, key);
241   };
242 };
243 extern struct device_iot_config_remove device_iot_config_remove;
244 
245 // Name: device_iot_config_clear
246 // Params: void
247 // Return: bool
248 struct device_iot_config_clear {
249   bool return_value{false};
250   std::function<bool(void)> body{[this]() { return return_value; }};
operatordevice_iot_config_clear251   bool operator()(void) { return body(); };
252 };
253 extern struct device_iot_config_clear device_iot_config_clear;
254 
255 // Name: device_iot_config_flush
256 // Params: void
257 // Return: void
258 struct device_iot_config_flush {
259   std::function<void(void)> body{[]() {}};
operatordevice_iot_config_flush260   void operator()(void){ body(); };
261 };
262 extern struct device_iot_config_flush device_iot_config_flush;
263 
264 // Name: device_debug_iot_config_dump
265 // Params: int fd
266 // Return: void
267 struct device_debug_iot_config_dump {
268   std::function<void(int fd)> body{[](int fd) {}};
operatordevice_debug_iot_config_dump269   void operator()(int fd) { body(fd); };
270 };
271 extern struct device_debug_iot_config_dump device_debug_iot_config_dump;
272 
273 }  // namespace device_iot_config
274 }  // namespace mock
275 }  // namespace test