• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2021 Huawei Device Co., Ltd.
2  *
3  * HDF is dual licensed: you can use it either under the terms of
4  * the GPL, or the BSD license, at your option.
5  * See the LICENSE file in the root of this repository for complete details.
6  */
7 
8 #include <cstdint>
9 #include <cstdio>
10 #include <cstdlib>
11 #include <fcntl.h>
12 #include <gtest/gtest.h>
13 #include <string>
14 #include <unistd.h>
15 #include "hdf_uhdf_test.h"
16 #include "hdf_io_service_if.h"
17 #include "pin_test.h"
18 
19 using namespace testing::ext;
20 
21 class HdfPinTest : public testing::Test {
22 public:
23     static void SetUpTestCase();
24     static void TearDownTestCase();
25     void SetUp();
26     void TearDown();
27 };
28 
SetUpTestCase()29 void HdfPinTest::SetUpTestCase()
30 {
31     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_SETUP_ALL, -1};
32     HdfTestOpenService();
33     HdfTestSendMsgToService(&msg);
34 }
35 
TearDownTestCase()36 void HdfPinTest::TearDownTestCase()
37 {
38     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_TEARDOWN_ALL, -1};
39     HdfTestSendMsgToService(&msg);
40     HdfTestCloseService();
41 }
42 
SetUp()43 void HdfPinTest::SetUp()
44 {
45 }
46 
TearDown()47 void HdfPinTest::TearDown()
48 {
49 }
50 
51 /**
52   * @tc.name: PinTestSetGetPinPull001
53   * @tc.desc: Pin set get pin Pull test
54   * @tc.type: FUNC
55   * @tc.require: NA
56   */
57 HWTEST_F(HdfPinTest, PinSetGetPull001, TestSize.Level1)
58 {
59     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_SETGETPULL, -1};
60     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
61 }
62 
63 /**
64   * @tc.name: PinTestSetGetStrength001
65   * @tc.desc: Pin set get pin Strength test
66   * @tc.type: FUNC
67   * @tc.require: NA
68   */
69 HWTEST_F(HdfPinTest, PinSetGetStrength001, TestSize.Level1)
70 {
71     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_SETGETSTRENGTH, -1};
72     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
73 }
74 
75 /**
76   * @tc.name: PinSetGetPinFunc001
77   * @tc.desc: Pin set get pin func test
78   * @tc.type: FUNC
79   * @tc.require: NA
80   */
81 HWTEST_F(HdfPinTest, PinSetGetPinFunc001, TestSize.Level1)
82 {
83     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_SETGETFUNC, -1};
84     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
85 }
86 
87 /**
88  * @tc.name: PinReliabilityTest001
89  * @tc.desc: Pin function test
90  * @tc.type: FUNC
91  * @tc.require:
92  */
93 HWTEST_F(HdfPinTest, PinReliabilityTest001, TestSize.Level1)
94 {
95     struct HdfTestMsg msg = {TEST_PAL_PIN_TYPE, PIN_TEST_CMD_RELIABILITY, -1};
96     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
97 }
98