• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include "hctest.h"
16 #include "iot_errno.h"
17 #ifdef CONFIG_PWM_SUPPORT
18 #include "iot_pwm.h"
19 #endif
20 
21 const unsigned int COMPILABILITY_TEST_PWM_PORT = 0xFFFFFFFF;
22 
23 /**
24  * @tc.desc      : register a test suite, this suite is used to test basic flow and interface dependency
25  * @param        : subsystem name is wifiiot
26  * @param        : module name is wifiiotlite
27  * @param        : test suit name is UtilsFileFuncTestSuite
28  */
29 LITE_TEST_SUIT(wifiiot, wifiiotlite, IotPwmTestSuite);
30 
31 #ifdef CONFIG_PWM_SUPPORT
32 /**
33  * @tc.setup     : setup for all testcases
34  * @return       : setup result, TRUE is success, FALSE is fail
35  */
IotPwmTestSuiteSetUp(void)36 static BOOL IotPwmTestSuiteSetUp(void)
37 {
38     return TRUE;
39 }
40 
41 /**
42  * @tc.teardown  : teardown for all testcases
43  * @return       : teardown result, TRUE is success, FALSE is fail
44  */
IotPwmTestSuiteTearDown(void)45 static BOOL IotPwmTestSuiteTearDown(void)
46 {
47     printf("+-------------------------------------------+\n");
48     return TRUE;
49 }
50 
51 /**
52  * @tc.number    : SUB_UTILS_WIFIIOT_API_4000
53  * @tc.name      : PWM operation with IoTPwmInit
54  * @tc.desc      : [C- SOFTWARE -0200]
55  */
56 LITE_TEST_CASE(IotPwmTestSuite, testIotPwm001, Function | MediumTest | Level1)
57 {
58     unsigned int ret;
59     ret = IoTPwmInit(COMPILABILITY_TEST_PWM_PORT);
60 };
61 
62 /**
63  * @tc.number    : SUB_UTILS_WIFIIOT_API_4100
64  * @tc.name      : PWM operation with IoTPwmStart
65  * @tc.desc      : [C- SOFTWARE -0200]
66  */
67 LITE_TEST_CASE(IotPwmTestSuite, testIotPwm002, Function | MediumTest | Level1)
68 {
69     unsigned int ret;
70     unsigned short duty = 20;
71     unsigned short freq = 2;
72 
73     ret = IoTPwmStart(COMPILABILITY_TEST_PWM_PORT, duty, freq);
74 };
75 
76 /**
77  * @tc.number    : SUB_UTILS_WIFIIOT_API_4200
78  * @tc.name      : PWM operation with IoTPwmStop
79  * @tc.desc      : [C- SOFTWARE -0200]
80  */
81 LITE_TEST_CASE(IotPwmTestSuite, testIotPwm003, Function | MediumTest | Level1)
82 {
83     unsigned int ret;
84     ret = IoTPwmStop(COMPILABILITY_TEST_PWM_PORT);
85 };
86 
87 /**
88  * @tc.number    : SUB_UTILS_WIFIIOT_API_4300
89  * @tc.name      : PWM operation with IoTPwmDeinit
90  * @tc.desc      : [C- SOFTWARE -0200]
91  */
92 LITE_TEST_CASE(IotPwmTestSuite, testIotPwm004, Function | MediumTest | Level1)
93 {
94     unsigned int ret;
95     ret = IoTPwmDeinit(COMPILABILITY_TEST_PWM_PORT);
96 };
97 #endif
98 
99 RUN_TEST_SUITE(IotPwmTestSuite);
100