• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
3  * This file contains confidential and proprietary information of
4  * OSWare Technology Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #include <cstdint>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <fcntl.h>
23 #include <gtest/gtest.h>
24 #include <string>
25 #include <unistd.h>
26 #include "hdf_uhdf_test.h"
27 #include "pwm_test.h"
28 #include "hdf_io_service_if.h"
29 
30 using namespace testing::ext;
31 
32 class HdfLitePwmTest : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp();
37     void TearDown();
38 };
39 
SetUpTestCase()40 void HdfLitePwmTest::SetUpTestCase()
41 {
42     HdfTestOpenService();
43 }
44 
TearDownTestCase()45 void HdfLitePwmTest::TearDownTestCase()
46 {
47     HdfTestCloseService();
48 }
49 
SetUp()50 void HdfLitePwmTest::SetUp()
51 {
52 }
53 
TearDown()54 void HdfLitePwmTest::TearDown()
55 {
56 }
57 
58 /**
59   * @tc.name: PwmSetPeriodTest001
60   * @tc.desc: pwm function test
61   * @tc.type: FUNC
62   * @tc.require: AR000F868C
63   */
64 HWTEST_F(HdfLitePwmTest, PwmSetPeriodTest001, TestSize.Level1)
65 {
66     struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_PERIOD_TEST, -1};
67     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
68 }
69 
70 /**
71   * @tc.name: PwmSetDutyTest001
72   * @tc.desc: pwm function test
73   * @tc.type: FUNC
74   * @tc.require: AR000F868C
75   */
76 HWTEST_F(HdfLitePwmTest, PwmSetDutyTest001, TestSize.Level1)
77 {
78     struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_DUTY_TEST, -1};
79     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
80 }
81 
82 /**
83   * @tc.name: PwmSetPolarityTest001
84   * @tc.desc: pwm function test
85   * @tc.type: FUNC
86   * @tc.require: AR000F868C
87   */
88 HWTEST_F(HdfLitePwmTest, PwmSetPolarityTest001, TestSize.Level1)
89 {
90     struct HdfTestMsg msg = { TEST_PAL_PWM_TYPE, PWM_SET_POLARITY_TEST, -1};
91     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
92 }
93 
94 /**
95   * @tc.name: PwmSetGetConfigTest001
96   * @tc.desc: pwm function test
97   * @tc.type: FUNC
98   * @tc.require: AR000F868D
99   */
100 HWTEST_F(HdfLitePwmTest, PwmSetGetConfigTest001, TestSize.Level1)
101 {
102     struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_SET_GET_CONFIG_TEST, -1};
103     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
104 }
105 
106 /**
107   * @tc.name: PwmEnableTest001
108   * @tc.desc: pwm function test
109   * @tc.type: FUNC
110   * @tc.require: AR000F868D
111   */
112 HWTEST_F(HdfLitePwmTest, PwmEnableTest001, TestSize.Level1)
113 {
114     struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_ENABLE_TEST, -1};
115     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
116 }
117 
118 /**
119   * @tc.name: PwmDisableTest001
120   * @tc.desc: pwm function test
121   * @tc.type: FUNC
122   * @tc.require: AR000F868D
123   */
124 HWTEST_F(HdfLitePwmTest, PwmDisableTest001, TestSize.Level1)
125 {
126     struct HdfTestMsg msg = {TEST_PAL_PWM_TYPE, PWM_DISABLE_TEST, -1};
127     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
128 }
129