Initialize Tizen 2.3
[framework/system/deviced.git] / test / testcase / utc_system_deviced_battery.c
1 /*
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of SAMSUNG
7  * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
8  * this software is owned by Samsung and you shall not disclose such
9  * Confidential Information and shall use it only in accordance with the terms
10  * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
11  * make no representations or warranties about the suitability of the software,
12  * either express or implied, including but not limited to the implied
13  * warranties of merchantability, fitness for a particular purpose, or
14  * non-infringement. SAMSUNG shall not be liable for any damages suffered by
15  * licensee arising out of or related to this software.
16  *
17  */
18 #include <tet_api.h>
19 #include <dd-battery.h>
20
21 #define API_NAME_BATTERY_GET_PERCENT "battery_get_percent"
22 #define API_NAME_BATTERY_GET_PERCENT_RAW "battery_get_percent_raw"
23 #define API_NAME_BATTERY_IS_FULL "battery_is_full"
24 #define API_NAME_BATTERY_GET_HEALTH "battery_get_health"
25
26 static void startup(void);
27 static void cleanup(void);
28
29 void (*tet_startup)(void) = startup;
30 void (*tet_cleanup)(void) = cleanup;
31
32
33 static void utc_system_deviced_battery_get_percent_p(void);
34 static void utc_system_deviced_battery_get_percent_raw_p(void);
35 static void utc_system_deviced_battery_is_full_p(void);
36 static void utc_system_deviced_battery_get_health_p(void);
37
38 enum {
39         POSITIVE_TC_IDX = 0x01,
40         NEGATIVE_TC_IDX,
41 };
42
43 struct tet_testlist tet_testlist[] = {
44         { utc_system_deviced_battery_get_percent_p, POSITIVE_TC_IDX },
45         { utc_system_deviced_battery_get_percent_raw_p, POSITIVE_TC_IDX },
46         { utc_system_deviced_battery_is_full_p, POSITIVE_TC_IDX },
47         { utc_system_deviced_battery_get_health_p, POSITIVE_TC_IDX },
48         { NULL, 0 },
49 };
50
51 static void startup(void)
52 {
53 }
54
55 static void cleanup(void)
56 {
57 }
58
59 /**
60  * @brief Positive test case of battery_get_percent()
61  */
62 static void utc_system_deviced_battery_get_percent_p(void)
63 {
64         int ret;
65
66         ret = battery_get_percent();
67         dts_check_ge(API_NAME_BATTERY_GET_PERCENT, ret, 0);
68 }
69
70 /**
71  * @brief Positive test case of battery_get_percent_raw()
72  */
73 static void utc_system_deviced_battery_get_percent_raw_p(void)
74 {
75         int ret;
76
77         ret = battery_get_percent_raw();
78         dts_check_ge(API_NAME_BATTERY_GET_PERCENT_RAW, ret, 0);
79 }
80
81 /**
82  * @brief Positive test case of battery_is_full()
83  */
84 static void utc_system_deviced_battery_is_full_p(void)
85 {
86         int ret;
87
88         ret = battery_is_full();
89         dts_check_ge(API_NAME_BATTERY_IS_FULL, ret, 0);
90 }
91
92 /**
93  * @brief Positive test case of battery_get_health()
94  */
95 static void utc_system_deviced_battery_get_health_p(void)
96 {
97         int ret;
98
99         ret = battery_get_health();
100         dts_check_ge(API_NAME_BATTERY_GET_HEALTH, ret, 0);
101 }