1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #include "audio_codec_base_test.h"
10 #include "audio_codec_base.h"
11 #include "audio_driver_log.h"
12
13 #define HDF_LOG_TAG audio_codec_base_test
14
CodecGetServiceNameTest(void)15 int32_t CodecGetServiceNameTest(void)
16 {
17 struct HdfDeviceObject device;
18 const char *drvCodecName = "";
19
20 if (CodecGetServiceName(NULL, NULL) == HDF_SUCCESS) {
21 return HDF_FAILURE;
22 }
23
24 if (CodecGetServiceName(&device, &drvCodecName) == HDF_SUCCESS) {
25 return HDF_FAILURE;
26 }
27
28 return HDF_SUCCESS;
29 }
30
CodecGetDaiNameTest(void)31 int32_t CodecGetDaiNameTest(void)
32 {
33 struct HdfDeviceObject device;
34 const char *drvCodecName = "";
35
36 if (CodecGetDaiName(NULL, NULL) == HDF_SUCCESS) {
37 return HDF_FAILURE;
38 }
39
40 if (CodecGetDaiName(&device, &drvCodecName) == HDF_SUCCESS) {
41 return HDF_FAILURE;
42 }
43
44 return HDF_SUCCESS;
45 }
46
CodecGetConfigInfoTest(void)47 int32_t CodecGetConfigInfoTest(void)
48 {
49 struct HdfDeviceObject device;
50 struct CodecData codecData;
51
52 if (CodecGetConfigInfo(NULL, NULL) == HDF_SUCCESS) {
53 return HDF_FAILURE;
54 }
55
56 if (CodecGetConfigInfo(&device, &codecData) == HDF_SUCCESS) {
57 return HDF_FAILURE;
58 }
59
60 return HDF_SUCCESS;
61 }
62
CodecSetConfigInfoTest(void)63 int32_t CodecSetConfigInfoTest(void)
64 {
65 struct DaiData device;
66 struct CodecData codecData;
67
68 (void)memset_s(&device, sizeof(struct DaiData), 0, sizeof(struct DaiData));
69 (void)memset_s(&codecData, sizeof(struct CodecData), 0, sizeof(struct CodecData));
70 if (CodecSetConfigInfo(NULL, NULL) == HDF_SUCCESS) {
71 return HDF_FAILURE;
72 }
73
74 if (CodecSetConfigInfo(&codecData, &device) == HDF_SUCCESS) {
75 return HDF_FAILURE;
76 }
77
78 return HDF_SUCCESS;
79 }
80
CodecSetCtlFuncTest(void)81 int32_t CodecSetCtlFuncTest(void)
82 {
83 struct CodecData codeData;
84
85 if (CodecSetCtlFunc(NULL, NULL, NULL) == HDF_SUCCESS) {
86 return HDF_FAILURE;
87 }
88
89 if (CodecSetCtlFunc(&codeData, NULL, NULL) == HDF_SUCCESS) {
90 return HDF_FAILURE;
91 }
92
93 return HDF_SUCCESS;
94 }
95