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