change system header file from dd-system to dd-deviced
[platform/core/system/system-server.git] / src / shared / TC / unit / utc_SystemFW_system_set_datetime_func.c
1 #include <tet_api.h>
2 #include <dd-deviced.h>
3
4 static void startup(void);
5 static void cleanup(void);
6
7 void (*tet_startup)(void) = startup;
8 void (*tet_cleanup)(void) = cleanup;
9
10 static void utc_SystemFW_deviced_set_datetime_func_01(void);
11 static void utc_SystemFW_deviced_set_datetime_func_02(void);
12
13 enum {
14         POSITIVE_TC_IDX = 0x01,
15         NEGATIVE_TC_IDX,
16 };
17
18 struct tet_testlist tet_testlist[] = {
19         { utc_SystemFW_deviced_set_datetime_func_01, POSITIVE_TC_IDX },
20         { utc_SystemFW_deviced_set_datetime_func_02, NEGATIVE_TC_IDX },
21         { NULL, 0 },
22 };
23
24 static void startup(void)
25 {
26 }
27
28 static void cleanup(void)
29 {
30 }
31
32 /**
33  * @brief Positive test case of deviced_set_datetime()
34  */
35 static void utc_SystemFW_deviced_set_datetime_func_01(void)
36 {
37         int ret_val = 0;
38         time_t timet = time(NULL);
39
40         ret_val = deviced_set_datetime(timet);
41         if(ret_val < 0) {
42                 tet_infoline("deviced_set_datetime() failed in positive test case");
43                 tet_result(TET_FAIL);
44                 return;
45         }
46         tet_result(TET_PASS);
47 }
48
49 /**
50  * @brief Negative test case of ug_init deviced_set_datetime()
51  */
52 static void utc_SystemFW_deviced_set_datetime_func_02(void)
53 {
54         int r = 0;
55
56         r = deviced_set_datetime(NULL);
57
58         if (r>=0) {
59                 tet_infoline("deviced_set_datetime() failed in negative test case");
60                 tet_result(TET_FAIL);
61                 return;
62         }
63         tet_result(TET_PASS);
64 }