• 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 <string>
24 #include <unistd.h>
25 #include <gtest/gtest.h>
26 #include "gpio_test.h"
27 #include "hdf_uhdf_test.h"
28 #include "hdf_io_service_if.h"
29 
30 using namespace testing::ext;
31 
32 class HdfLiteGpioTest : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp();
37     void TearDown();
38 };
39 
SetUpTestCase()40 void HdfLiteGpioTest::SetUpTestCase()
41 {
42     HdfTestOpenService();
43 }
44 
TearDownTestCase()45 void HdfLiteGpioTest::TearDownTestCase()
46 {
47     HdfTestCloseService();
48 }
49 
SetUp()50 void HdfLiteGpioTest::SetUp()
51 {
52 }
53 
TearDown()54 void HdfLiteGpioTest::TearDown()
55 {
56 }
57 
58 /**
59   * @tc.name: GpioTestSetGetDir001
60   * @tc.desc: gpio set and get dir test
61   * @tc.type: FUNC
62   * @tc.require: AR000F868H
63   */
64 HWTEST_F(HdfLiteGpioTest, GpioTestSetGetDir001, TestSize.Level1)
65 {
66     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_SET_GET_DIR, -1};
67     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
68 }
69 
70 /**
71   * @tc.name: GpioTestWriteRead001
72   * @tc.desc: gpio write and read test
73   * @tc.type: FUNC
74   * @tc.require: AR000F868H
75   */
76 HWTEST_F(HdfLiteGpioTest, GpioTestWriteRead001, TestSize.Level1)
77 {
78     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_WRITE_READ, -1};
79     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
80 }
81 
82 /**
83   * @tc.name: GpioTestIrqLevel001
84   * @tc.desc: gpio level irq trigger test
85   * @tc.type: FUNC
86   * @tc.require: AR000F868H
87   */
88 HWTEST_F(HdfLiteGpioTest, GpioTestIrqLevel001, TestSize.Level1)
89 {
90     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_LEVEL, -1};
91     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
92 }
93 
94 /**
95   * @tc.name: GpioTestIrqEdge001
96   * @tc.desc: gpio edge irq trigger test
97   * @tc.type: FUNC
98   * @tc.require: AR000F868H
99   */
100 HWTEST_F(HdfLiteGpioTest, GpioTestIrqEdge001, TestSize.Level1)
101 {
102     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_EDGE, -1};
103     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
104 }
105 
106 /**
107   * @tc.name: GpioTestIrqThread001
108   * @tc.desc: gpio thread irq trigger test
109   * @tc.type: FUNC
110   * @tc.require: AR000F868H
111   */
112 HWTEST_F(HdfLiteGpioTest, GpioTestIrqThread001, TestSize.Level1)
113 {
114     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_IRQ_THREAD, -1};
115     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
116 }
117 
118 /**
119   * @tc.name: GpioTestReliability001
120   * @tc.desc: gpio reliability test
121   * @tc.type: FUNC
122   * @tc.require: AR000F868H
123   */
124 HWTEST_F(HdfLiteGpioTest, GpioTestReliability001, TestSize.Level1)
125 {
126     struct HdfTestMsg msg = {TEST_PAL_GPIO_TYPE, GPIO_TEST_RELIABILITY, -1};
127     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
128 }
129