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