• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "effect_common.h"
17 #include "hdf_base.h"
18 #include "hdf_log.h"
19 #include "osal_mem.h"
20 #include "v1_0/effect_types.h"
21 #include "v1_0/ieffect_control.h"
22 #include "v1_0/ieffect_model.h"
23 #include <gtest/gtest.h>
24 
25 using namespace std;
26 using namespace testing::ext;
27 constexpr bool IS_DIRECTLY_CALL = false;
28 /* the input buffer len of the send command */
29 constexpr uint32_t SEND_COMMAND_LEN = 10;
30 constexpr uint32_t SEND_COMMAND_LEN_TEST1 = 0;
31 /* the output buffer len of the command */
32 constexpr uint32_t GET_BUFFER_LEN = 10;
33 
34 namespace {
35 class EffectControlTestAdditional : public testing::Test {
36 public:
37     struct IEffectControl *controller_ = nullptr;
38     struct IEffectModel *model_ = nullptr;
39     struct ControllerId contollerId_;
40     virtual void SetUp();
41     virtual void TearDown();
42 };
43 
SetUp()44 void EffectControlTestAdditional::SetUp()
45 {
46     struct EffectInfo info = {
47         .libName = strdup("libmock_effect_lib"),
48         .effectId = strdup("aaaabbbb-8888-9999-6666-aabbccdd9966ff"),
49         .ioDirection = 1,
50     };
51 
52     model_ = IEffectModelGet(IS_DIRECTLY_CALL);
53     if (model_ == nullptr) {
54         GTEST_SKIP() << "model_ is nullptr" << std::endl;
55         return;
56     }
57 
58     int32_t ret = model_->CreateEffectController(model_, &info, &controller_, &contollerId_);
59     ASSERT_EQ(ret, HDF_SUCCESS);
60     ASSERT_NE(controller_, nullptr);
61 }
62 
TearDown()63 void EffectControlTestAdditional::TearDown()
64 {
65     if (controller_ != nullptr && model_ != nullptr) {
66         int32_t ret = model_->DestroyEffectController(model_, &contollerId_);
67         EXPECT_EQ(ret, HDF_SUCCESS);
68     }
69 
70     if (model_ != nullptr) {
71         IEffectModelRelease(model_, IS_DIRECTLY_CALL);
72     }
73 }
74 
75 /**
76  * @tc.number: SUB_Driver_Audio_EffectProcess_0400
77  * @tc.name: testEffectProcess001
78  * @tc.desc: Verify the EffectControlEffectProcess function when the input parameter is invalid.
79  */
80 HWTEST_F(EffectControlTestAdditional, testEffectProcess001, TestSize.Level2)
81 {
82     EXPECT_NE(HDF_SUCCESS, controller_->EffectProcess(controller_, nullptr, nullptr));
83 }
84 
85 /**
86  * @tc.number: SUB_Driver_Audio_EffectProcess_0500
87  * @tc.name: testEffectProcess002
88  * @tc.desc: Verify the reliability of the EffectControlEffectProcess function.
89  */
90 HWTEST_F(EffectControlTestAdditional, testEffectProcess002, TestSize.Level1)
91 {
92     struct AudioEffectBuffer input = {0};
93     struct AudioEffectBuffer output = {0};
94     int32_t ret = HDF_SUCCESS;
95 
96     for (int32_t i = 0; i < 1000; i++) {
97         ret = controller_->EffectProcess(controller_, &input, &output);
98         EXPECT_EQ(ret, HDF_SUCCESS);
99     }
100 }
101 
102 /**
103  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1000
104  * @tc.name: testEffectSendCommand001
105  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is
106  * AUDIO_EFFECT_COMMAND_INIT_CONTOLLER.
107  */
108 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand001, TestSize.Level1)
109 {
110     int8_t input[SEND_COMMAND_LEN] = {0};
111     int8_t output[GET_BUFFER_LEN] = {0};
112     uint32_t replyLen = GET_BUFFER_LEN;
113     int32_t ret = HDF_SUCCESS;
114 
115     for (int32_t i = 0; i < 1000; i++) {
116         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, input, SEND_COMMAND_LEN,
117                                        output, &replyLen);
118         EXPECT_EQ(ret, HDF_SUCCESS);
119     }
120 }
121 
122 /**
123  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1100
124  * @tc.name: testEffectSendCommand002
125  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_INIT_CONTOLLER.
126  */
127 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand002, TestSize.Level2)
128 {
129     int8_t input[SEND_COMMAND_LEN] = {0};
130     int8_t output[GET_BUFFER_LEN] = {0};
131     uint32_t replyLen = GET_BUFFER_LEN;
132 
133     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, input,
134                                            SEND_COMMAND_LEN_TEST1, output, &replyLen);
135     EXPECT_NE(ret, HDF_SUCCESS);
136 }
137 
138 /**
139  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1300
140  * @tc.name: testEffectSendCommand004
141  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
142  */
143 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand004, TestSize.Level2)
144 {
145     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, nullptr, SEND_COMMAND_LEN,
146                                            nullptr, nullptr);
147     EXPECT_NE(ret, HDF_SUCCESS);
148 }
149 
150 /**
151  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1400
152  * @tc.name: testEffectSendCommand005
153  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is
154  * AUDIO_EFFECT_COMMAND_SET_PARAM.
155  */
156 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand005, TestSize.Level1)
157 {
158     int8_t input[SEND_COMMAND_LEN] = {0};
159     int8_t output[GET_BUFFER_LEN] = {0};
160     uint32_t replyLen = GET_BUFFER_LEN;
161     int32_t ret = HDF_SUCCESS;
162 
163     for (int32_t i = 0; i < 1000; i++) {
164         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, input, SEND_COMMAND_LEN, output,
165                                        &replyLen);
166         EXPECT_EQ(ret, HDF_SUCCESS);
167     }
168 }
169 
170 /**
171  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1500
172  * @tc.name: testEffectSendCommand006
173  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_SET_PARAM.
174  */
175 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand006, TestSize.Level2)
176 {
177     int8_t input[SEND_COMMAND_LEN] = {0};
178     int8_t output[GET_BUFFER_LEN] = {0};
179     uint32_t replyLen = GET_BUFFER_LEN;
180 
181     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, input, SEND_COMMAND_LEN_TEST1,
182                                            output, &replyLen);
183     EXPECT_NE(ret, HDF_SUCCESS);
184 }
185 
186 /**
187  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1600
188  * @tc.name: testEffectSendCommand007
189  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
190  */
191 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand007, TestSize.Level2)
192 {
193     int8_t output[GET_BUFFER_LEN] = {0};
194     uint32_t replyLen = GET_BUFFER_LEN;
195 
196     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, nullptr, SEND_COMMAND_LEN,
197                                            output, &replyLen);
198     EXPECT_NE(ret, HDF_SUCCESS);
199 }
200 
201 /**
202  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1700
203  * @tc.name: testEffectSendCommand008
204  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
205  */
206 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand008, TestSize.Level2)
207 {
208     int8_t input[SEND_COMMAND_LEN] = {0};
209     uint32_t replyLen = GET_BUFFER_LEN;
210 
211     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, input, SEND_COMMAND_LEN,
212                                            nullptr, &replyLen);
213     EXPECT_NE(ret, HDF_SUCCESS);
214 }
215 
216 /**
217  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1800
218  * @tc.name: testEffectSendCommand009
219  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
220  */
221 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand009, TestSize.Level2)
222 {
223     int8_t input[SEND_COMMAND_LEN] = {0};
224     int8_t output[GET_BUFFER_LEN] = {0};
225 
226     int32_t ret =
227         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, input, SEND_COMMAND_LEN, output, nullptr);
228     EXPECT_NE(ret, HDF_SUCCESS);
229 }
230 
231 /**
232  * @tc.number: SUB_Driver_Audio_EffectSendCommand_1900
233  * @tc.name: testEffectSendCommand010
234  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
235  */
236 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand010, TestSize.Level2)
237 {
238     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_PARAM, nullptr, SEND_COMMAND_LEN,
239                                            nullptr, nullptr);
240     EXPECT_NE(ret, HDF_SUCCESS);
241 }
242 
243 /**
244  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2000
245  * @tc.name: testEffectSendCommand011
246  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is
247  * AUDIO_EFFECT_COMMAND_SET_CONFIG.
248  */
249 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand011, TestSize.Level1)
250 {
251     int8_t input[SEND_COMMAND_LEN] = {0};
252     int8_t output[GET_BUFFER_LEN] = {0};
253     uint32_t replyLen = GET_BUFFER_LEN;
254     int32_t ret = HDF_SUCCESS;
255 
256     for (int32_t i = 0; i < 1000; i++) {
257         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, input, SEND_COMMAND_LEN, output,
258                                        &replyLen);
259         EXPECT_EQ(ret, HDF_SUCCESS);
260     }
261 }
262 
263 /**
264  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2100
265  * @tc.name: testEffectSendCommand012
266  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_SET_CONFIG.
267  */
268 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand012, TestSize.Level2)
269 {
270     int8_t input[SEND_COMMAND_LEN] = {0};
271     int8_t output[GET_BUFFER_LEN] = {0};
272     uint32_t replyLen = GET_BUFFER_LEN;
273 
274     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, input, SEND_COMMAND_LEN_TEST1,
275                                            output, &replyLen);
276     EXPECT_NE(ret, HDF_SUCCESS);
277 }
278 
279 /**
280  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2200
281  * @tc.name: testEffectSendCommand013
282  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
283  */
284 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand013, TestSize.Level2)
285 {
286     int8_t output[GET_BUFFER_LEN] = {0};
287     uint32_t replyLen = GET_BUFFER_LEN;
288 
289     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, nullptr, SEND_COMMAND_LEN,
290                                            output, &replyLen);
291     EXPECT_NE(ret, HDF_SUCCESS);
292 }
293 
294 /**
295  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2300
296  * @tc.name: testEffectSendCommand014
297  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
298  */
299 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand014, TestSize.Level2)
300 {
301     int8_t input[SEND_COMMAND_LEN] = {0};
302     uint32_t replyLen = GET_BUFFER_LEN;
303 
304     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, input, SEND_COMMAND_LEN,
305                                            nullptr, &replyLen);
306     EXPECT_NE(ret, HDF_SUCCESS);
307 }
308 
309 /**
310  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2400
311  * @tc.name: testEffectSendCommand015
312  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
313  */
314 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand015, TestSize.Level2)
315 {
316     int8_t input[SEND_COMMAND_LEN] = {0};
317     int8_t output[GET_BUFFER_LEN] = {0};
318 
319     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, input, SEND_COMMAND_LEN,
320                                            output, nullptr);
321     EXPECT_NE(ret, HDF_SUCCESS);
322 }
323 
324 /**
325  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2500
326  * @tc.name: testEffectSendCommand016
327  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
328  */
329 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand016, TestSize.Level2)
330 {
331     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_SET_CONFIG, nullptr, SEND_COMMAND_LEN,
332                                            nullptr, nullptr);
333     EXPECT_NE(ret, HDF_SUCCESS);
334 }
335 
336 /**
337  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2600
338  * @tc.name: testEffectSendCommand017
339  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is
340  * AUDIO_EFFECT_COMMAND_GET_CONFIG.
341  */
342 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand017, TestSize.Level1)
343 {
344     int8_t input[SEND_COMMAND_LEN] = {0};
345     int8_t output[GET_BUFFER_LEN] = {0};
346     uint32_t replyLen = GET_BUFFER_LEN;
347     int32_t ret = HDF_SUCCESS;
348 
349     for (int32_t i = 0; i < 1000; i++) {
350         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, input, SEND_COMMAND_LEN, output,
351                                        &replyLen);
352         EXPECT_EQ(ret, HDF_SUCCESS);
353     }
354 }
355 
356 /**
357  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2700
358  * @tc.name: testEffectSendCommand018
359  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_GET_CONFIG.
360  */
361 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand018, TestSize.Level2)
362 {
363     int8_t input[SEND_COMMAND_LEN] = {0};
364     int8_t output[GET_BUFFER_LEN] = {0};
365     uint32_t replyLen = GET_BUFFER_LEN;
366 
367     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, input, SEND_COMMAND_LEN_TEST1,
368                                            output, &replyLen);
369     EXPECT_NE(ret, HDF_SUCCESS);
370 }
371 
372 /**
373  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2800
374  * @tc.name: testEffectSendCommand019
375  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
376  */
377 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand019, TestSize.Level2)
378 {
379     int8_t output[GET_BUFFER_LEN] = {0};
380     uint32_t replyLen = GET_BUFFER_LEN;
381 
382     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, nullptr, SEND_COMMAND_LEN,
383                                            output, &replyLen);
384     EXPECT_NE(ret, HDF_SUCCESS);
385 }
386 
387 /**
388  * @tc.number: SUB_Driver_Audio_EffectSendCommand_2900
389  * @tc.name: testEffectSendCommand020
390  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
391  */
392 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand020, TestSize.Level2)
393 {
394     int8_t input[SEND_COMMAND_LEN] = {0};
395     uint32_t replyLen = GET_BUFFER_LEN;
396 
397     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, input, SEND_COMMAND_LEN,
398                                            nullptr, &replyLen);
399     EXPECT_NE(ret, HDF_SUCCESS);
400 }
401 
402 /**
403  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3000
404  * @tc.name: testEffectSendCommand021
405  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
406  */
407 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand021, TestSize.Level2)
408 {
409     int8_t input[SEND_COMMAND_LEN] = {0};
410     int8_t output[GET_BUFFER_LEN] = {0};
411 
412     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, input, SEND_COMMAND_LEN,
413                                            output, nullptr);
414     EXPECT_NE(ret, HDF_SUCCESS);
415 }
416 
417 /**
418  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3100
419  * @tc.name: testEffectSendCommand022
420  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
421  */
422 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand022, TestSize.Level2)
423 {
424     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_GET_CONFIG, nullptr, SEND_COMMAND_LEN,
425                                            nullptr, nullptr);
426     EXPECT_NE(ret, HDF_SUCCESS);
427 }
428 
429 /**
430  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3200
431  * @tc.name: testEffectSendCommand023
432  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_RESET.
433  */
434 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand023, TestSize.Level1)
435 {
436     int8_t input[SEND_COMMAND_LEN] = {0};
437     int8_t output[GET_BUFFER_LEN] = {0};
438     uint32_t replyLen = GET_BUFFER_LEN;
439     int32_t ret = HDF_SUCCESS;
440 
441     for (int32_t i = 0; i < 1000; i++) {
442         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, input, SEND_COMMAND_LEN, output,
443                                        &replyLen);
444         EXPECT_EQ(ret, HDF_SUCCESS);
445     }
446 }
447 
448 /**
449  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3300
450  * @tc.name: testEffectSendCommand024
451  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_RESET.
452  */
453 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand024, TestSize.Level2)
454 {
455     int8_t input[SEND_COMMAND_LEN] = {0};
456     int8_t output[GET_BUFFER_LEN] = {0};
457     uint32_t replyLen = GET_BUFFER_LEN;
458 
459     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, input, SEND_COMMAND_LEN_TEST1,
460                                            output, &replyLen);
461     EXPECT_NE(ret, HDF_SUCCESS);
462 }
463 
464 /**
465  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3400
466  * @tc.name: testEffectSendCommand025
467  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
468  */
469 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand025, TestSize.Level2)
470 {
471     int8_t output[GET_BUFFER_LEN] = {0};
472     uint32_t replyLen = GET_BUFFER_LEN;
473 
474     int32_t ret =
475         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, nullptr, SEND_COMMAND_LEN, output, &replyLen);
476     EXPECT_NE(ret, HDF_SUCCESS);
477 }
478 
479 /**
480  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3500
481  * @tc.name: testEffectSendCommand026
482  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
483  */
484 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand026, TestSize.Level2)
485 {
486     int8_t input[SEND_COMMAND_LEN] = {0};
487     uint32_t replyLen = GET_BUFFER_LEN;
488 
489     int32_t ret =
490         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, input, SEND_COMMAND_LEN, nullptr, &replyLen);
491     EXPECT_NE(ret, HDF_SUCCESS);
492 }
493 
494 /**
495  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3600
496  * @tc.name: testEffectSendCommand027
497  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
498  */
499 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand027, TestSize.Level2)
500 {
501     int8_t input[SEND_COMMAND_LEN] = {0};
502     int8_t output[GET_BUFFER_LEN] = {0};
503 
504     int32_t ret =
505         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, input, SEND_COMMAND_LEN, output, nullptr);
506     EXPECT_NE(ret, HDF_SUCCESS);
507 }
508 
509 /**
510  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3700
511  * @tc.name: testEffectSendCommand028
512  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
513  */
514 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand028, TestSize.Level2)
515 {
516     int32_t ret =
517         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_RESET, nullptr, SEND_COMMAND_LEN, nullptr, nullptr);
518     EXPECT_NE(ret, HDF_SUCCESS);
519 }
520 
521 /**
522  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3800
523  * @tc.name: testEffectSendCommand029
524  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_ENABLE.
525  */
526 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand029, TestSize.Level1)
527 {
528     int8_t input[SEND_COMMAND_LEN] = {0};
529     int8_t output[GET_BUFFER_LEN] = {0};
530     uint32_t replyLen = GET_BUFFER_LEN;
531     int32_t ret = HDF_SUCCESS;
532 
533     for (int32_t i = 0; i < 1000; i++) {
534         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, input, SEND_COMMAND_LEN, output,
535                                        &replyLen);
536         EXPECT_EQ(ret, HDF_SUCCESS);
537     }
538 }
539 
540 /**
541  * @tc.number: SUB_Driver_Audio_EffectSendCommand_3900
542  * @tc.name: testEffectSendCommand030
543  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_ENABLE.
544  */
545 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand030, TestSize.Level2)
546 {
547     int8_t input[SEND_COMMAND_LEN] = {0};
548     int8_t output[GET_BUFFER_LEN] = {0};
549     uint32_t replyLen = GET_BUFFER_LEN;
550 
551     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, input, SEND_COMMAND_LEN_TEST1,
552                                            output, &replyLen);
553     EXPECT_NE(ret, HDF_SUCCESS);
554 }
555 
556 /**
557  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4000
558  * @tc.name: testEffectSendCommand031
559  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
560  */
561 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand031, TestSize.Level2)
562 {
563     int8_t output[GET_BUFFER_LEN] = {0};
564     uint32_t replyLen = GET_BUFFER_LEN;
565 
566     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, nullptr, SEND_COMMAND_LEN, output,
567                                            &replyLen);
568     EXPECT_NE(ret, HDF_SUCCESS);
569 }
570 
571 /**
572  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4100
573  * @tc.name: testEffectSendCommand032
574  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
575  */
576 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand032, TestSize.Level2)
577 {
578     int8_t input[SEND_COMMAND_LEN] = {0};
579     uint32_t replyLen = GET_BUFFER_LEN;
580 
581     int32_t ret =
582         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, input, SEND_COMMAND_LEN, nullptr, &replyLen);
583     EXPECT_NE(ret, HDF_SUCCESS);
584 }
585 
586 /**
587  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4200
588  * @tc.name: testEffectSendCommand033
589  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
590  */
591 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand033, TestSize.Level2)
592 {
593     int8_t input[SEND_COMMAND_LEN] = {0};
594     int8_t output[GET_BUFFER_LEN] = {0};
595 
596     int32_t ret =
597         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, input, SEND_COMMAND_LEN, output, nullptr);
598     EXPECT_NE(ret, HDF_SUCCESS);
599 }
600 
601 /**
602  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4300
603  * @tc.name: testEffectSendCommand034
604  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
605  */
606 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand034, TestSize.Level2)
607 {
608     int32_t ret =
609         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_ENABLE, nullptr, SEND_COMMAND_LEN, nullptr, nullptr);
610     EXPECT_NE(ret, HDF_SUCCESS);
611 }
612 
613 /**
614  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4400
615  * @tc.name: testEffectSendCommand035
616  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_DISABLE.
617  */
618 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand035, TestSize.Level1)
619 {
620     int8_t input[SEND_COMMAND_LEN] = {0};
621     int8_t output[GET_BUFFER_LEN] = {0};
622     uint32_t replyLen = GET_BUFFER_LEN;
623     int32_t ret = HDF_SUCCESS;
624 
625     for (int32_t i = 0; i < 1000; i++) {
626         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, output,
627                                        &replyLen);
628         EXPECT_EQ(ret, HDF_SUCCESS);
629     }
630 }
631 
632 /**
633  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4500
634  * @tc.name: testEffectSendCommand036
635  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_DISABLE.
636  */
637 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand036, TestSize.Level2)
638 {
639     int8_t input[SEND_COMMAND_LEN] = {0};
640     int8_t output[GET_BUFFER_LEN] = {0};
641     uint32_t replyLen = GET_BUFFER_LEN;
642 
643     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN_TEST1,
644                                            output, &replyLen);
645     EXPECT_NE(ret, HDF_SUCCESS);
646 }
647 
648 /**
649  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4600
650  * @tc.name: testEffectSendCommand037
651  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
652  */
653 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand037, TestSize.Level2)
654 {
655     int8_t output[GET_BUFFER_LEN] = {0};
656     uint32_t replyLen = GET_BUFFER_LEN;
657 
658     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, nullptr, SEND_COMMAND_LEN, output,
659                                            &replyLen);
660     EXPECT_NE(ret, HDF_SUCCESS);
661 }
662 
663 /**
664  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4700
665  * @tc.name: testEffectSendCommand038
666  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
667  */
668 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand038, TestSize.Level2)
669 {
670     int8_t input[SEND_COMMAND_LEN] = {0};
671     uint32_t replyLen = GET_BUFFER_LEN;
672 
673     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, nullptr,
674                                            &replyLen);
675     EXPECT_NE(ret, HDF_SUCCESS);
676 }
677 
678 /**
679  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4800
680  * @tc.name: testEffectSendCommand039
681  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
682  */
683 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand039, TestSize.Level2)
684 {
685     int8_t input[SEND_COMMAND_LEN] = {0};
686     int8_t output[GET_BUFFER_LEN] = {0};
687 
688     int32_t ret =
689         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, output, nullptr);
690     EXPECT_NE(ret, HDF_SUCCESS);
691 }
692 
693 /**
694  * @tc.number: SUB_Driver_Audio_EffectSendCommand_4900
695  * @tc.name: testEffectSendCommand040
696  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
697  */
698 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand040, TestSize.Level2)
699 {
700     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, nullptr, SEND_COMMAND_LEN,
701                                            nullptr, nullptr);
702     EXPECT_NE(ret, HDF_SUCCESS);
703 }
704 
705 /**
706  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5000
707  * @tc.name: testEffectSendCommand041
708  * @tc.desc: Verify the reliability of the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_DISABLE.
709  */
710 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand041, TestSize.Level1)
711 {
712     int8_t input[SEND_COMMAND_LEN] = {0};
713     int8_t output[GET_BUFFER_LEN] = {0};
714     uint32_t replyLen = GET_BUFFER_LEN;
715     int32_t ret = HDF_SUCCESS;
716 
717     for (int32_t i = 0; i < 1000; i++) {
718         ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, output,
719                                        &replyLen);
720         EXPECT_EQ(ret, HDF_SUCCESS);
721     }
722 }
723 
724 /**
725  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5100
726  * @tc.name: testEffectSendCommand042
727  * @tc.desc: Verify the EffectControlSendCommand function when cmdId is AUDIO_EFFECT_COMMAND_DISABLE.
728  */
729 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand042, TestSize.Level2)
730 {
731     int8_t input[SEND_COMMAND_LEN] = {0};
732     int8_t output[GET_BUFFER_LEN] = {0};
733     uint32_t replyLen = GET_BUFFER_LEN;
734 
735     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN_TEST1,
736                                            output, &replyLen);
737     EXPECT_NE(ret, HDF_SUCCESS);
738 }
739 
740 /**
741  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5200
742  * @tc.name: testEffectSendCommand043
743  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
744  */
745 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand043, TestSize.Level2)
746 {
747     int8_t output[GET_BUFFER_LEN] = {0};
748     uint32_t replyLen = GET_BUFFER_LEN;
749 
750     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, nullptr, SEND_COMMAND_LEN, output,
751                                            &replyLen);
752     EXPECT_NE(ret, HDF_SUCCESS);
753 }
754 
755 /**
756  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5300
757  * @tc.name: testEffectSendCommand044
758  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
759  */
760 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand044, TestSize.Level2)
761 {
762     int8_t input[SEND_COMMAND_LEN] = {0};
763     uint32_t replyLen = GET_BUFFER_LEN;
764 
765     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, nullptr,
766                                            &replyLen);
767     EXPECT_NE(ret, HDF_SUCCESS);
768 }
769 
770 /**
771  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5400
772  * @tc.name: testEffectSendCommand045
773  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
774  */
775 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand045, TestSize.Level2)
776 {
777     int8_t input[SEND_COMMAND_LEN] = {0};
778     int8_t output[GET_BUFFER_LEN] = {0};
779 
780     int32_t ret =
781         controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, input, SEND_COMMAND_LEN, output, nullptr);
782     EXPECT_NE(ret, HDF_SUCCESS);
783 }
784 
785 /**
786  * @tc.number: SUB_Driver_Audio_EffectSendCommand_5500
787  * @tc.name: testEffectSendCommand046
788  * @tc.desc: Verify the EffectControlSendCommand function when the input parameter is invalid.
789  */
790 HWTEST_F(EffectControlTestAdditional, testEffectSendCommand046, TestSize.Level2)
791 {
792     int32_t ret = controller_->SendCommand(controller_, AUDIO_EFFECT_COMMAND_DISABLE, nullptr, SEND_COMMAND_LEN,
793                                            nullptr, nullptr);
794     EXPECT_NE(ret, HDF_SUCCESS);
795 }
796 
797 /**
798  * @tc.number: SUB_Driver_Audio_GetEffectDescriptor_0300
799  * @tc.name: testEffectGetEffectDescriptor001
800  * @tc.desc: Verify the GetEffectDescriptor function when the input parameter is invalid.
801  */
802 HWTEST_F(EffectControlTestAdditional, testEffectGetEffectDescriptor001, TestSize.Level2)
803 {
804     EXPECT_NE(HDF_SUCCESS, controller_->GetEffectDescriptor(nullptr, nullptr));
805 }
806 
807 /**
808  * @tc.number: SUB_Driver_Audio_GetEffectDescriptor_0400
809  * @tc.name: testEffectGetEffectDescriptor002
810  * @tc.desc: Verify the reliability of the GetEffectDescriptor function.
811  */
812 HWTEST_F(EffectControlTestAdditional, testEffectGetEffectDescriptor002, TestSize.Level1)
813 {
814     struct EffectControllerDescriptor desc;
815     int32_t ret = HDF_SUCCESS;
816     for (int32_t i = 0; i < 1000; i++) {
817         ret = controller_->GetEffectDescriptor(controller_, &desc);
818         EXPECT_EQ(ret, HDF_SUCCESS);
819     }
820 }
821 
822 /**
823  * @tc.number: SUB_Driver_Audio_EffectReverse_0300
824  * @tc.name: testEffectEffectReverse001
825  * @tc.desc: Verify the EffectReverse function when the input parameter is invalid.
826  */
827 HWTEST_F(EffectControlTestAdditional, testEffectEffectReverse001, TestSize.Level2)
828 {
829     EXPECT_NE(HDF_SUCCESS, controller_->EffectReverse(nullptr, nullptr, nullptr));
830 }
831 
832 /**
833  * @tc.number: SUB_Driver_Audio_EffectReverse_0400
834  * @tc.name: testEffectEffectReverse002
835  * @tc.desc: Verify the reliability of the EffectReverse function.
836  */
837 HWTEST_F(EffectControlTestAdditional, testEffectEffectReverse002, TestSize.Level1)
838 {
839     struct AudioEffectBuffer input = {0};
840     struct AudioEffectBuffer output = {0};
841     int32_t ret = HDF_SUCCESS;
842     for (int32_t i = 0; i < 1000; i++) {
843         ret = controller_->EffectReverse(controller_, &input, &output);
844         EXPECT_EQ(ret, HDF_SUCCESS);
845     }
846 }
847 } // end of namespace
848