Initialize Tizen 2.3
[apps/home/libslp-alarm.git] / TC / unit / utc_alarmdb_get_power_onoff_by_author_func.c
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.1 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://floralicense.org/license/
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 /***************************************
20 * add your header file here
21 * e.g.,
22 * #include "utc_ApplicationLib_recurGetDayOfWeek_func.h"
23 ***************************************/
24 #include "utc_alarmdb_get_power_onoff_by_author_func.h"
25
26 /***************************************
27 * add Test Case Wide Declarations
28 * e.g.,
29 * static char msg[256];
30 ***************************************/
31 struct alarm_data *ad;
32 int alarmdb_id;
33
34 static void startup()
35 {
36         tet_printf("\n TC startup");
37         /* add your code here */
38         int ret;
39         ret = alarmdb_init(NULL);
40         if (!ret)
41                 tet_printf("\n alarmdb_init succeed!");
42
43         ad = alarmdb_create_data();
44         if (ad == NULL)
45                 tet_printf("\n failed to create data");
46
47         ad->author = AUTHOR_TIMER;
48         ad->auto_power_on = 1;
49
50         alarmdb_id = alarmdb_add_data(ad);
51         if (alarmdb_id > -1)
52                 tet_printf("\n Succeed to add an alarm data");
53 }
54
55 static void cleanup()
56 {
57         tet_printf("\n TC End");
58         /* add your code here */
59         if (alarmdb_id > -1) {
60                 alarmdb_del_data(alarmdb_id);
61                 alarmdb_id = -1;
62         }
63         if (ad) {
64                 alarmdb_free_data(ad);
65                 ad = NULL;
66         }
67         alarmdb_fini();
68 }
69
70 /***************************************
71 * Add your callback function here
72 * if needed
73 ***************************************/
74
75 /***************************************
76 * add your Test Cases
77 * e.g.,
78 * static void utc_ApplicationLib_recurGetDayOfWeek_01()
79 * {
80 *   int ret;
81 *
82 *   ret = target_api();
83 *   if(ret == 1)
84 *       tet_result(TET_PASS);
85 *   else
86 *       tet_result(TET_FAIL);
87 * }
88 *
89 * static void utc_ApplicationLib_recurGetDayOfWeek_02()
90 * {
91 *       code..
92 *       condition1
93 *           tet_result(TET_PASS);
94 *       condition2
95 *           tet_result(TET_FAIL);
96 * }
97 *
98 ***************************************/
99
100 static void utc_alarmdb_get_power_onoff_by_author_func_01()
101 {
102         int ret;
103         ret = alarmdb_get_power_onoff_by_author(AUTHOR_TIMER);
104         if (ret == 1)
105                 tet_result(TET_PASS);
106         else
107                 tet_result(TET_FAIL);
108 }
109
110 static void utc_alarmdb_get_power_onoff_by_author_func_02()
111 {
112         int ret;
113         ret = alarmdb_get_power_onoff_by_author(ALARM_DB_AUTHOR_ALARM);
114         if (ret != 1)
115                 tet_result(TET_PASS);
116         else
117                 tet_result(TET_FAIL);
118 }