Initialize Tizen 2.3
[apps/home/libslp-alarm.git] / TC / unit / utc_alarmdb_set_snooze_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_set_snooze_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         alarmdb_id = alarmdb_add_data(ad);
48         if (alarmdb_id > -1)
49                 tet_printf("\n Succeed to add an alarm data");
50 }
51
52 static void cleanup()
53 {
54         tet_printf("\n TC End");
55         /* add your code here */
56         if (alarmdb_id > -1) {
57                 alarmdb_del_data(alarmdb_id);
58                 alarmdb_id = -1;
59         }
60         if (ad) {
61                 alarmdb_free_data(ad);
62                 ad = NULL;
63         }
64         alarmdb_fini();
65 }
66
67 /***************************************
68 * Add your callback function here
69 * if needed
70 ***************************************/
71
72 /***************************************
73 * add your Test Cases
74 * e.g.,
75 * static void utc_ApplicationLib_recurGetDayOfWeek_01()
76 * {
77 *   int ret;
78 *
79 *   ret = target_api();
80 *   if(ret == 1)
81 *       tet_result(TET_PASS);
82 *   else
83 *       tet_result(TET_FAIL);
84 * }
85 *
86 * static void utc_ApplicationLib_recurGetDayOfWeek_02()
87 * {
88 *       code..
89 *       condition1
90 *           tet_result(TET_PASS);
91 *       condition2
92 *           tet_result(TET_FAIL);
93 * }
94 *
95 ***************************************/
96
97 static void utc_alarmdb_set_snooze_func_01()
98 {
99         int ret;
100         ret = alarmdb_set_snooze(alarmdb_id, 0);
101         if (ret == 0)
102                 tet_result(TET_PASS);
103         else
104                 tet_result(TET_FAIL);
105 }