• 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 "hdf_uhdf_test.h"
27 #include "hdf_io_service_if.h"
28 #include "rtc_test.h"
29 
30 using namespace testing::ext;
31 
32 class HdfRtcTest : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp();
37     void TearDown();
38 };
39 
SetUpTestCase()40 void HdfRtcTest::SetUpTestCase()
41 {
42     HdfTestOpenService();
43 }
44 
TearDownTestCase()45 void HdfRtcTest::TearDownTestCase()
46 {
47     HdfTestCloseService();
48 }
49 
SetUp()50 void HdfRtcTest::SetUp()
51 {
52 }
53 
TearDown()54 void HdfRtcTest::TearDown()
55 {
56 }
57 
58 /**
59   * @tc.name: testRtcReadWriteTime001
60   * @tc.desc: rtc function test
61   * @tc.type: FUNC
62   * @tc.require: AR000F868I
63   */
64 HWTEST_F(HdfRtcTest, testRtcReadWriteTime001, TestSize.Level1)
65 {
66     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_TIME, -1 };
67     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
68 }
69 
70 /**
71   * @tc.name: testRtcReadWriteMaxTime001
72   * @tc.desc: rtc function test
73   * @tc.type: FUNC
74   * @tc.require: AR000F868I
75   */
76 HWTEST_F(HdfRtcTest, testRtcReadWriteMaxTime001, TestSize.Level1)
77 {
78     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_MAX_TIME, -1 };
79     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
80 }
81 
82 /**
83   * @tc.name: testRtcReadWriteMinTime001
84   * @tc.desc: rtc function test
85   * @tc.type: FUNC
86   * @tc.require: AR000F868I
87   */
88 HWTEST_F(HdfRtcTest, testRtcReadWriteMinTime001, TestSize.Level1)
89 {
90     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_MIN_TIME, -1 };
91     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
92 }
93 
94 /**
95   * @tc.name: testRtcReadWriteAlarmTime001
96   * @tc.desc: rtc function test
97   * @tc.type: FUNC
98   * @tc.require: AR000F868I
99   */
100 HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmTime001, TestSize.Level1)
101 {
102     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_TIME, -1 };
103     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
104 }
105 
106 /**
107   * @tc.name: testRtcReadWriteAlarmMaxTime001
108   * @tc.desc: rtc function test
109   * @tc.type: FUNC
110   * @tc.require: AR000F868I
111   */
112 HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmMaxTime001, TestSize.Level1)
113 {
114     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_MAX_TIME, -1 };
115     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
116 }
117 /**
118   * @tc.name: testRtcReadWriteAlarmMinTime001
119   * @tc.desc: rtc function test
120   * @tc.type: FUNC
121   * @tc.require: AR000F868I
122   */
123 HWTEST_F(HdfRtcTest, testRtcReadWriteAlarmMinTime001, TestSize.Level1)
124 {
125     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_WR_ALARM_MIN_TIME, -1 };
126     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
127 }
128 
129 #ifndef HDF_LITEOS_TEST
130 /**
131   * @tc.name: testRtcAlarmEnable001
132   * @tc.desc: rtc function test
133   * @tc.type: FUNC
134   * @tc.require: AR000F868I
135   */
136 HWTEST_F(HdfRtcTest, testRtcAlarmEnable001, TestSize.Level1)
137 {
138     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_ALARM_ENABLE, -1 };
139     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
140 }
141 #endif
142 
143 #if defined(HDF_LITEOS_TEST)
144 
145 /**
146   * @tc.name: testRtcAlarmIrq001
147   * @tc.desc: rtc function test
148   * @tc.type: FUNC
149   * @tc.require: AR000EKRKU
150   */
151 HWTEST_F(HdfRtcTest, testRtcAlarmIrq001, TestSize.Level1)
152 {
153     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_ALARM_IRQ, -1 };
154     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
155 }
156 
157 /**
158   * @tc.name: testRtcRegCallback001
159   * @tc.desc: rtc function test
160   * @tc.type: FUNC
161   * @tc.require: AR000EKRKU
162   */
163 HWTEST_F(HdfRtcTest, testRtcRegCallback001, TestSize.Level1)
164 {
165     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_REGISTER_CALLBACK, -1 };
166     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
167 }
168 
169 /**
170   * @tc.name: testRtcRegCallbackNull001
171   * @tc.desc: rtc function test
172   * @tc.type: FUNC
173   * @tc.require: AR000EKRKU
174   */
175 HWTEST_F(HdfRtcTest, testRtcRegCallbackNull001, TestSize.Level1)
176 {
177     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_REGISTER_CALLBACK_NULL, -1 };
178     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
179 }
180 
181 /**
182   * @tc.name: testRtcFreq001
183   * @tc.desc: rtc function test
184   * @tc.type: FUNC
185   * @tc.require: AR000EKRKU
186   */
187 HWTEST_F(HdfRtcTest, testRtcFreq001, TestSize.Level1)
188 {
189     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_FREQ, -1 };
190     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
191 }
192 
193 /**
194   * @tc.name: testRtcMaxFreq001
195   * @tc.desc: rtc function test
196   * @tc.type: FUNC
197   * @tc.require: AR000EKRKU
198   */
199 HWTEST_F(HdfRtcTest, testRtcMaxFreq001, TestSize.Level1)
200 {
201     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_MAX_FREQ, -1 };
202     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
203 }
204 
205 /**
206   * @tc.name: testRtcMinFreq001
207   * @tc.desc: rtc function test
208   * @tc.type: FUNC
209   * @tc.require: AR000EKRKU
210   */
211 HWTEST_F(HdfRtcTest, testRtcMinFreq001, TestSize.Level1)
212 {
213     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_MIN_FREQ, -1 };
214     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
215 }
216 
217 /**
218   * @tc.name: testRtcUserReg001
219   * @tc.desc: rtc function test
220   * @tc.type: FUNC
221   * @tc.require: AR000EKRKU
222   */
223 HWTEST_F(HdfRtcTest, testRtcUserReg001, TestSize.Level1)
224 {
225     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_USER_REG, -1 };
226     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
227 }
228 
229 /**
230   * @tc.name: testRtcUserRegMaxIndex001
231   * @tc.desc: rtc function test
232   * @tc.type: FUNC
233   * @tc.require: AR000EKRKU
234   */
235 HWTEST_F(HdfRtcTest, testRtcUserRegMaxIndex001, TestSize.Level1)
236 {
237     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_USER_REG_MAX_INDEX, -1 };
238     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
239 }
240 #endif
241 /**
242   * @tc.name: testRtcReliability001
243   * @tc.desc: rtc function test
244   * @tc.type: FUNC
245   * @tc.require: AR000EKRKU
246   */
247 HWTEST_F(HdfRtcTest, testRtcReliability001, TestSize.Level1)
248 {
249     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_WR_RELIABILITY, -1 };
250     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
251 }
252 
253 #if defined(HDF_LITEOS_TEST)
254 /**
255   * @tc.name: testRtcModule001
256   * @tc.desc: rtc function test
257   * @tc.type: FUNC
258   * @tc.require: AR000EKRKU
259   */
260 HWTEST_F(HdfRtcTest, testRtcModule001, TestSize.Level1)
261 {
262     struct HdfTestMsg msg = { TEST_PAL_RTC_TYPE, RTC_TEST_CMD_RTC_FUNCTION_TEST, -1 };
263     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
264 }
265 #endif
266