• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 
16 #include <algorithm>
17 #include <cmath>
18 #include <cstdio>
19 #include <gtest/gtest.h>
20 #include <fcntl.h>
21 #include <functional>
22 #include <securec.h>
23 #include <unistd.h>
24 
25 #include <fstream>
26 #include "v1_2/battery_interface_proxy.h"
27 #include "v1_2/ibattery_callback.h"
28 #include "v1_2/types.h"
29 
30 using namespace OHOS::HDI::Battery;
31 using namespace OHOS::HDI::Battery::V1_2;
32 using namespace testing::ext;
33 using namespace OHOS;
34 
35 namespace {
36 class BatteryCallback : public HDI::Battery::V1_2::IBatteryCallback {
37 public:
BatteryCallback()38     BatteryCallback() {};
~BatteryCallback()39     ~BatteryCallback() override {};
Update(const HDI::Battery::V1_2::BatteryInfo & event)40     int32_t Update(const HDI::Battery::V1_2::BatteryInfo& event) override
41     {
42         (void)event;
43         return 0;
44     };
45 };
46 
47 sptr<IBatteryInterface> g_batteryInterface = nullptr;
48 sptr<IBatteryCallback> g_callback = new BatteryCallback();
49 }
50 
51 class HdfBatteryHdiTest : public testing::Test {
52 public:
53     static void SetUpTestCase();
54     static void TearDownTestCase();
55     void SetUp();
56     void TearDown();
57     static int32_t ReadFile(const char *path, char *buf, size_t size);
58     static int32_t ConvertInt(const std::string &value);
59 };
60 
SetUpTestCase(void)61 void HdfBatteryHdiTest::SetUpTestCase(void)
62 {
63     g_batteryInterface = IBatteryInterface::Get(true);
64 }
65 
TearDownTestCase(void)66 void HdfBatteryHdiTest::TearDownTestCase(void)
67 {
68 }
69 
SetUp(void)70 void HdfBatteryHdiTest::SetUp(void)
71 {
72 }
73 
TearDown(void)74 void HdfBatteryHdiTest::TearDown(void)
75 {
76 }
77 
78 namespace {
79 /**
80   * @tc.name: HdfBatteryHdiTest001
81   * @tc.desc: Get a client and check whether the client is empty.
82   * @tc.type: FUNC
83   */
84 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest001, TestSize.Level1)
85 {
86     EXPECT_TRUE(nullptr != g_batteryInterface);
87 }
88 
89 /**
90   * @tc.name: HdfBatteryHdiTest002
91   * @tc.desc: Register
92   * @tc.type: FUNC
93   */
94 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest002, TestSize.Level1)
95 {
96     if (false) {
97         printf("HdfBatteryHdiTest002: start.");
98         int32_t ret = g_batteryInterface->Register(g_callback);
99         EXPECT_EQ(0, ret) << "HdfBatteryHdiTest002 failed";
100 
101         printf("HdfBatteryHdiTest002: return.");
102     }
103 }
104 
105 /**
106   * @tc.name: HdfBatteryHdiTest003
107   * @tc.desc: UnRegister
108   * @tc.type: FUNC
109   */
110 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest003, TestSize.Level1)
111 {
112     if (false) {
113         printf("HdfBatteryHdiTest003: start.");
114         int32_t ret = g_batteryInterface->UnRegister();
115         EXPECT_EQ(0, ret) << "HdfBatteryHdiTest002 failed";
116 
117         printf("HdfBatteryHdiTest003: return.");
118     }
119 }
120 
121 /**
122   * @tc.name: HdfBatteryHdiTest004
123   * @tc.desc: ChangePath
124   * @tc.type: FUNC
125   */
126 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest004, TestSize.Level1)
127 {
128     printf("HdfBatteryHdiTest004: start.");
129     std::string path;
130     EXPECT_TRUE(HDF_SUCCESS == g_batteryInterface->ChangePath(path));
131 
132     printf("HdfBatteryHdiTest004: return.");
133 }
134 
135 /**
136   * @tc.name: HdfBatteryHdiTest005
137   * @tc.desc: GetCapacity
138   * @tc.type: FUNC
139   */
140 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest005, TestSize.Level1)
141 {
142     printf("HdfBatteryHdiTest005: start.");
143     int capacity;
144     g_batteryInterface->GetCapacity(capacity);
145     EXPECT_TRUE(capacity <= 100 && capacity >= 0);
146 
147     printf("HdfBatteryHdiTest005: return.");
148 }
149 
150 /**
151   * @tc.name: HdfBatteryHdiTest006
152   * @tc.desc: GetVoltage
153   * @tc.type: FUNC
154   */
155 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest006, TestSize.Level1)
156 {
157     printf("HdfBatteryHdiTest006: start.");
158     int voltage;
159     g_batteryInterface->GetVoltage(voltage);
160     EXPECT_TRUE(voltage >= 0);
161 
162     printf("HdfBatteryHdiTest006: return.");
163 }
164 
165 /**
166   * @tc.name: HdfBatteryHdiTest007
167   * @tc.desc: GetTemperature
168   * @tc.type: FUNC
169   */
170 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest007, TestSize.Level1)
171 {
172     printf("HdfBatteryHdiTest007: start.");
173     int temperature;
174     g_batteryInterface->GetTemperature(temperature);
175     EXPECT_TRUE(temperature >= 0 && temperature <= 600);
176 
177     printf("HdfBatteryHdiTest007: return.");
178 }
179 
180 /**
181   * @tc.name: HdfBatteryHdiTest008
182   * @tc.desc: GetHealthState
183   * @tc.type: FUNC
184   */
185 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest008, TestSize.Level1)
186 {
187     printf("HdfBatteryHdiTest007: start.");
188     OHOS::HDI::Battery::V1_2::BatteryHealthState healthState = OHOS::HDI::Battery::V1_2::BatteryHealthState(0);
189     g_batteryInterface->GetHealthState(healthState);
190     EXPECT_TRUE(healthState >= 0 && healthState <= 6);
191 
192     printf("HdfBatteryHdiTest007: return.");
193 }
194 
195 /**
196   * @tc.name: HdfBatteryHdiTest009
197   * @tc.desc: GetPluggedType
198   * @tc.type: FUNC
199   */
200 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest009, TestSize.Level1)
201 {
202     printf("HdfBatteryHdiTest009: start.");
203     OHOS::HDI::Battery::V1_2::BatteryPluggedType pluggedType = OHOS::HDI::Battery::V1_2::BatteryPluggedType(0);
204     g_batteryInterface->GetPluggedType(pluggedType);
205     EXPECT_TRUE(pluggedType >= OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_NONE &&
206         pluggedType <= OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_BUTT);
207 
208     printf("HdfBatteryHdiTest009: return.");
209 }
210 
211 /**
212   * @tc.name: HdfBatteryHdiTest010
213   * @tc.desc: GetChargeState
214   * @tc.type: FUNC
215   */
216 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest010, TestSize.Level1)
217 {
218     printf("HdfBatteryHdiTest010: start.");
219     OHOS::HDI::Battery::V1_2::BatteryChargeState chargeState = OHOS::HDI::Battery::V1_2::BatteryChargeState(0);
220     g_batteryInterface->GetChargeState(chargeState);
221     EXPECT_TRUE(chargeState >= 0 && chargeState <= 4);
222 
223     printf("HdfBatteryHdiTest010: return.");
224 }
225 
226 /**
227   * @tc.name: HdfBatteryHdiTest011
228   * @tc.desc: GetPresent
229   * @tc.type: FUNC
230   */
231 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest011, TestSize.Level1)
232 {
233     printf("HdfBatteryHdiTest011: start.");
234     bool present = false;
235     EXPECT_TRUE(HDF_SUCCESS == g_batteryInterface->GetPresent(present));
236     printf("HdfBatteryHdiTest011: return.");
237 }
238 
239 /**
240   * @tc.name: HdfBatteryHdiTest012
241   * @tc.desc: GetTechnology
242   * @tc.type: FUNC
243   */
244 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest012, TestSize.Level1)
245 {
246     printf("HdfBatteryHdiTest012: start.");
247     std::string technology;
248     g_batteryInterface->GetTechnology(technology);
249     EXPECT_FALSE(technology.empty());
250 
251     printf("HdfBatteryHdiTest012: return.");
252 }
253 
254 /**
255   * @tc.name: HdfBatteryHdiTest013
256   * @tc.desc: GetTotalEnergy
257   * @tc.type: FUNC
258   */
259 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest013, TestSize.Level1)
260 {
261     printf("HdfBatteryHdiTest013: start.");
262     int32_t totalEnergy = -1;
263     g_batteryInterface->GetTotalEnergy(totalEnergy);
264     EXPECT_TRUE(totalEnergy >= 0);
265 
266     printf("HdfBatteryHdiTest013: return.");
267 }
268 
269 /**
270   * @tc.name: HdfBatteryHdiTest014
271   * @tc.desc: GetCurrentAverage
272   * @tc.type: FUNC
273   */
274 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest014, TestSize.Level1)
275 {
276     printf("HdfBatteryHdiTest014: start.");
277     int curAverage = -1;
278     g_batteryInterface->GetCurrentAverage(curAverage);
279     EXPECT_TRUE(curAverage != 0);
280 
281     printf("HdfBatteryHdiTest014: return.");
282 }
283 
284 /**
285   * @tc.name: HdfBatteryHdiTest015
286   * @tc.desc: GetCurrentNow
287   * @tc.type: FUNC
288   */
289 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest015, TestSize.Level1)
290 {
291     printf("HdfBatteryHdiTest015: start.");
292     int32_t nowCurr = -1;
293     g_batteryInterface->GetCurrentNow(nowCurr);
294     EXPECT_TRUE(nowCurr != -1);
295 
296     printf("HdfBatteryHdiTest015: return.");
297 }
298 
299 /**
300   * @tc.name: HdfBatteryHdiTest016
301   * @tc.desc: GetRemainEnergy
302   * @tc.type: FUNC
303   */
304 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest016, TestSize.Level1)
305 {
306     printf("HdfBatteryHdiTest016: start.");
307     int32_t remainEnergy = -1;
308     g_batteryInterface->GetRemainEnergy(remainEnergy);
309     EXPECT_TRUE(remainEnergy >= 0);
310 
311     printf("HdfBatteryHdiTest016: return.");
312 }
313 
314 /**
315   * @tc.name: HdfBatteryHdiTest017
316   * @tc.desc: GetBatteryInfo
317   * @tc.type: FUNC
318   */
319 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest017, TestSize.Level1)
320 {
321     printf("HdfBatteryHdiTest017: start.");
322     OHOS::HDI::Battery::V1_2::BatteryInfo event = {
323         .capacity = -1,
324     };
325     g_batteryInterface->GetBatteryInfo(event);
326     EXPECT_TRUE(-1 != event.capacity);
327 
328     printf("HdfBatteryHdiTest017: return.");
329 }
330 
331 /**
332  * @tc.name: HdfBatteryHdiTest018
333  * @tc.desc: GetChargeType
334  * @tc.type: FUNC
335  */
336 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest018, TestSize.Level1)
337 {
338     printf("HdfBatteryHdiTest018: start.");
339     OHOS::HDI::Battery::V1_2::ChargeType chargeType = OHOS::HDI::Battery::V1_2::ChargeType(0);
340     g_batteryInterface->GetChargeType(chargeType);
341     EXPECT_TRUE(chargeType >= OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_NONE &&
342         chargeType <= OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRELESS_SUPER_QUICK);
343 
344     printf("HdfBatteryHdiTest018: return.");
345 }
346 
347 /**
348  * @tc.name: HdfBatteryHdiTest019
349  * @tc.desc: Judgment ChargeType enum value of the Types.idl
350  * @tc.type: FUNC
351  */
352 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest019, TestSize.Level1)
353 {
354     printf("HdfBatteryHdiTest019: start.");
355     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_NONE == 0);
356     printf("HdfBatteryHdiTest019: return.");
357 }
358 
359 /**
360  * @tc.name: HdfBatteryHdiTest020
361  * @tc.desc: Test limit charging current
362  * @tc.type: FUNC
363  */
364 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest020, TestSize.Level1)
365 {
366     ChargingLimit scLimit;
367     scLimit.type = TYPE_CURRENT;
368     scLimit.protocol = "sc";
369     scLimit.value = 1000;
370     ChargingLimit buckLimit;
371     buckLimit.type = TYPE_CURRENT;
372     buckLimit.protocol = "buck";
373     buckLimit.value = 1100;
374     std::vector<ChargingLimit> chargeLimitList;
375     chargeLimitList.push_back(scLimit);
376     chargeLimitList.push_back(buckLimit);
377     int32_t result = g_batteryInterface->SetChargingLimit(chargeLimitList);
378     EXPECT_EQ(true, result == ERR_OK);
379 
380     std::string currentPath = "/data/service/el0/battery/current_limit";
381     std::string line;
382     std::string chargeLimitStr;
383     std::string writeChargeInfo = scLimit.protocol + " " + std::to_string(scLimit.value) + "\n" +
384         buckLimit.protocol + " " + std::to_string(buckLimit.value) + "\n";
385     std::ifstream fin(currentPath.c_str());
386     if (fin) {
387         while (getline(fin, line)) {
388             chargeLimitStr += line + "\n";
389         }
390     }
391     EXPECT_EQ(true, chargeLimitStr == writeChargeInfo);
392 }
393 
394 /**
395  * @tc.name: HdfBatteryHdiTest021
396  * @tc.desc: Test limit charging voltage
397  * @tc.type: FUNC
398  */
399 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest021, TestSize.Level1)
400 {
401     ChargingLimit scLimit;
402     scLimit.type = TYPE_VOLTAGE;
403     scLimit.protocol = "sc";
404     scLimit.value = 2000;
405     ChargingLimit buckLimit;
406     buckLimit.type = TYPE_VOLTAGE;
407     buckLimit.protocol = "buck";
408     buckLimit.value = 3000;
409     std::vector<ChargingLimit> chargeLimitList;
410     chargeLimitList.push_back(scLimit);
411     chargeLimitList.push_back(buckLimit);
412     int32_t result = g_batteryInterface->SetChargingLimit(chargeLimitList);
413     EXPECT_EQ(true, result == ERR_OK);
414 
415     std::string voltagePath = "/data/service/el0/battery/voltage_limit";
416     std::string line;
417     std::string voltageLimitStr;
418     std::string writeVoltageInfo = scLimit.protocol + " " + std::to_string(scLimit.value) + "\n" +
419         buckLimit.protocol + " " + std::to_string(buckLimit.value) + "\n";
420     std::ifstream fin(voltagePath.c_str());
421     if (fin) {
422         while (getline(fin, line)) {
423             voltageLimitStr += line + "\n";
424         }
425     }
426     EXPECT_EQ(true, voltageLimitStr == writeVoltageInfo);
427 }
428 
429 /**
430  * @tc.name: HdfBatteryHdiTest022
431  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
432  * @tc.type: FUNC
433  */
434 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest022, TestSize.Level3)
435 {
436     printf("HdfBatteryHdiTest022: start.");
437     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_UNKNOWN == 0);
438     printf("HdfBatteryHdiTest022: end.");
439 }
440 
441 /**
442  * @tc.name: HdfBatteryHdiTest023
443  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
444  * @tc.type: FUNC
445  */
446 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest023, TestSize.Level3)
447 {
448     printf("HdfBatteryHdiTest023: start.");
449     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_GOOD == 1);
450     printf("HdfBatteryHdiTest023: end.");
451 }
452 
453 /**
454  * @tc.name: HdfBatteryHdiTest024
455  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
456  * @tc.type: FUNC
457  */
458 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest024, TestSize.Level3)
459 {
460     printf("HdfBatteryHdiTest024: start.");
461     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_OVERHEAT == 2);
462     printf("HdfBatteryHdiTest024: end.");
463 }
464 
465 /**
466  * @tc.name: HdfBatteryHdiTest025
467  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
468  * @tc.type: FUNC
469  */
470 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest025, TestSize.Level3)
471 {
472     printf("HdfBatteryHdiTest025: start.");
473     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_OVERVOLTAGE == 3);
474     printf("HdfBatteryHdiTest025: end.");
475 }
476 
477 /**
478  * @tc.name: HdfBatteryHdiTest026
479  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
480  * @tc.type: FUNC
481  */
482 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest026, TestSize.Level3)
483 {
484     printf("HdfBatteryHdiTest026: start.");
485     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_COLD == 4);
486     printf("HdfBatteryHdiTest026: end.");
487 }
488 
489 /**
490  * @tc.name: HdfBatteryHdiTest027
491  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
492  * @tc.type: FUNC
493  */
494 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest027, TestSize.Level3)
495 {
496     printf("HdfBatteryHdiTest027: start.");
497     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_DEAD == 5);
498     printf("HdfBatteryHdiTest027: end.");
499 }
500 
501 /**
502  * @tc.name: HdfBatteryHdiTest028
503  * @tc.desc: Judgment BatteryHealthState enum value of the Types.idl
504  * @tc.type: FUNC
505  */
506 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest028, TestSize.Level3)
507 {
508     printf("HdfBatteryHdiTest028: start.");
509     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryHealthState::BATTERY_HEALTH_RESERVED == 6);
510     printf("HdfBatteryHdiTest028: end.");
511 }
512 
513 /**
514  * @tc.name: HdfBatteryHdiTest029
515  * @tc.desc: Judgment BatteryChargeState enum value of the Types.idl
516  * @tc.type: FUNC
517  */
518 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest029, TestSize.Level3)
519 {
520     printf("HdfBatteryHdiTest029: start.");
521     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryChargeState::CHARGE_STATE_NONE == 0);
522     printf("HdfBatteryHdiTest029: end.");
523 }
524 
525 /**
526  * @tc.name: HdfBatteryHdiTest030
527  * @tc.desc: Judgment BatteryChargeState enum value of the Types.idl
528  * @tc.type: FUNC
529  */
530 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest030, TestSize.Level3)
531 {
532     printf("HdfBatteryHdiTest030: start.");
533     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryChargeState::CHARGE_STATE_ENABLE == 1);
534     printf("HdfBatteryHdiTest030: end.");
535 }
536 
537 /**
538  * @tc.name: HdfBatteryHdiTest031
539  * @tc.desc: Judgment BatteryChargeState enum value of the Types.idl
540  * @tc.type: FUNC
541  */
542 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest031, TestSize.Level3)
543 {
544     printf("HdfBatteryHdiTest031: start.");
545     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryChargeState::CHARGE_STATE_DISABLE == 2);
546     printf("HdfBatteryHdiTest031: end.");
547 }
548 
549 /**
550  * @tc.name: HdfBatteryHdiTest032
551  * @tc.desc: Judgment BatteryChargeState enum value of the Types.idl
552  * @tc.type: FUNC
553  */
554 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest032, TestSize.Level3)
555 {
556     printf("HdfBatteryHdiTest032: start.");
557     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryChargeState::CHARGE_STATE_FULL == 3);
558     printf("HdfBatteryHdiTest032: end.");
559 }
560 
561 /**
562  * @tc.name: HdfBatteryHdiTest033
563  * @tc.desc: Judgment BatteryChargeState enum value of the Types.idl
564  * @tc.type: FUNC
565  */
566 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest033, TestSize.Level3)
567 {
568     printf("HdfBatteryHdiTest033: start.");
569     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryChargeState::CHARGE_STATE_RESERVED == 4);
570     printf("HdfBatteryHdiTest033: end.");
571 }
572 
573 /**
574  * @tc.name: HdfBatteryHdiTest034
575  * @tc.desc: Judgment BatteryPluggedType enum value of the Types.idl
576  * @tc.type: FUNC
577  */
578 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest034, TestSize.Level3)
579 {
580     printf("HdfBatteryHdiTest034: start.");
581     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_NONE == 0);
582     printf("HdfBatteryHdiTest034: end.");
583 }
584 
585 /**
586  * @tc.name: HdfBatteryHdiTest035
587  * @tc.desc: Judgment BatteryPluggedType enum value of the Types.idl
588  * @tc.type: FUNC
589  */
590 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest035, TestSize.Level3)
591 {
592     printf("HdfBatteryHdiTest035: start.");
593     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_AC == 1);
594     printf("HdfBatteryHdiTest035: end.");
595 }
596 
597 /**
598  * @tc.name: HdfBatteryHdiTest036
599  * @tc.desc: Judgment BatteryPluggedType enum value of the Types.idl
600  * @tc.type: FUNC
601  */
602 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest036, TestSize.Level3)
603 {
604     printf("HdfBatteryHdiTest036: start.");
605     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_USB == 2);
606     printf("HdfBatteryHdiTest036: end.");
607 }
608 
609 /**
610  * @tc.name: HdfBatteryHdiTest037
611  * @tc.desc: Judgment BatteryPluggedType enum value of the Types.idl
612  * @tc.type: FUNC
613  */
614 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest037, TestSize.Level3)
615 {
616     printf("HdfBatteryHdiTest037: start.");
617     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_WIRELESS == 3);
618     printf("HdfBatteryHdiTest037: end.");
619 }
620 
621 /**
622  * @tc.name: HdfBatteryHdiTest038
623  * @tc.desc: Judgment BatteryPluggedType enum value of the Types.idl
624  * @tc.type: FUNC
625  */
626 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest038, TestSize.Level3)
627 {
628     printf("HdfBatteryHdiTest038: start.");
629     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::BatteryPluggedType::PLUGGED_TYPE_BUTT == 4);
630     printf("HdfBatteryHdiTest038: end.");
631 }
632 
633 /**
634  * @tc.name: HdfBatteryHdiTest039
635  * @tc.desc: Judgment ChargingLimitType enum value of the Types.idl
636  * @tc.type: FUNC
637  */
638 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest039, TestSize.Level3)
639 {
640     printf("HdfBatteryHdiTest039: start.");
641     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargingLimitType::TYPE_CURRENT == 0);
642     printf("HdfBatteryHdiTest039: end.");
643 }
644 
645 /**
646  * @tc.name: HdfBatteryHdiTest040
647  * @tc.desc: Judgment ChargingLimitType enum value of the Types.idl
648  * @tc.type: FUNC
649  */
650 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest040, TestSize.Level3)
651 {
652     printf("HdfBatteryHdiTest040: start.");
653     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargingLimitType::TYPE_VOLTAGE == 1);
654     printf("HdfBatteryHdiTest040: end.");
655 }
656 
657 
658 /**
659  * @tc.name: HdfBatteryHdiTest041
660  * @tc.desc: Judgment ChargeType enum value of the Types.idl
661  * @tc.type: FUNC
662  */
663 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest041, TestSize.Level3)
664 {
665     printf("HdfBatteryHdiTest041: start.");
666     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRED_NORMAL == 1);
667     printf("HdfBatteryHdiTest041: end.");
668 }
669 
670 /**
671  * @tc.name: HdfBatteryHdiTest042
672  * @tc.desc: Judgment ChargeType enum value of the Types.idl
673  * @tc.type: FUNC
674  */
675 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest042, TestSize.Level3)
676 {
677     printf("HdfBatteryHdiTest042: start.");
678     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRED_QUICK == 2);
679     printf("HdfBatteryHdiTest042: end.");
680 }
681 
682 /**
683  * @tc.name: HdfBatteryHdiTest043
684  * @tc.desc: Judgment ChargeType enum value of the Types.idl
685  * @tc.type: FUNC
686  */
687 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest043, TestSize.Level3)
688 {
689     printf("HdfBatteryHdiTest043: start.");
690     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRED_SUPER_QUICK == 3);
691     printf("HdfBatteryHdiTest043: end.");
692 }
693 
694 /**
695  * @tc.name: HdfBatteryHdiTest044
696  * @tc.desc: Judgment ChargeType enum value of the Types.idl
697  * @tc.type: FUNC
698  */
699 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest044, TestSize.Level3)
700 {
701     printf("HdfBatteryHdiTest044: start.");
702     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRELESS_NORMAL == 4);
703     printf("HdfBatteryHdiTest044: end.");
704 }
705 
706 /**
707  * @tc.name: HdfBatteryHdiTest045
708  * @tc.desc: Judgment ChargeType enum value of the Types.idl
709  * @tc.type: FUNC
710  */
711 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest045, TestSize.Level3)
712 {
713     printf("HdfBatteryHdiTest045: start.");
714     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRELESS_QUICK == 5);
715     printf("HdfBatteryHdiTest045: end.");
716 }
717 
718 /**
719  * @tc.name: HdfBatteryHdiTest046
720  * @tc.desc: Judgment ChargeType enum value of the Types.idl
721  * @tc.type: FUNC
722  */
723 HWTEST_F(HdfBatteryHdiTest, HdfBatteryHdiTest046, TestSize.Level3)
724 {
725     printf("HdfBatteryHdiTest046: start.");
726     EXPECT_TRUE(OHOS::HDI::Battery::V1_2::ChargeType::CHARGE_TYPE_WIRELESS_SUPER_QUICK == 6);
727     printf("HdfBatteryHdiTest046: end.");
728 }
729 }
730