[Request]Update Flora license version
[apps/home/libslp-alarm.git] / TC / unit / utc_alarmdb_free_data_list_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_free_data_list_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 struct alarm_data_list *adl;
33 int alarmdb_id;
34
35 static void startup()
36 {
37         tet_printf("\n TC startup");
38         /* add your code here */
39         int ret;
40         ret = alarmdb_init(NULL);
41         if (!ret)
42                 tet_printf("\n alarmdb_init succeed!");
43
44         ad = alarmdb_create_data();
45         if (ad == NULL)
46                 tet_printf("\n failed to create data");
47
48         alarmdb_id = alarmdb_add_data(ad);
49         if (alarmdb_id > -1)
50                 tet_printf("\n Succeed to add an alarm data");
51
52         adl = alarmdb_get_data_list_all();
53         if (adl)
54                 tet_printf("\n Succeed to get data list all");
55 }
56
57 static void cleanup()
58 {
59         tet_printf("\n TC End");
60         /* add your code here */
61         if (alarmdb_id > -1) {
62                 alarmdb_del_data(alarmdb_id);
63                 alarmdb_id = -1;
64         }
65         if (ad) {
66                 alarmdb_free_data(ad);
67                 ad = NULL;
68         }
69         if (adl) {
70                 alarmdb_free_data_list(adl);
71                 adl = NULL;
72         }
73         alarmdb_fini();
74 }
75
76 /***************************************
77 * Add your callback function here
78 * if needed
79 ***************************************/
80
81 /***************************************
82 * add your Test Cases
83 * e.g.,
84 * static void utc_ApplicationLib_recurGetDayOfWeek_01()
85 * {
86 *   int ret;
87 *
88 *   ret = target_api();
89 *   if(ret == 1)
90 *       tet_result(TET_PASS);
91 *   else
92 *       tet_result(TET_FAIL);
93 * }
94 *
95 * static void utc_ApplicationLib_recurGetDayOfWeek_02()
96 * {
97 *       code..
98 *       condition1
99 *           tet_result(TET_PASS);
100 *       condition2
101 *           tet_result(TET_FAIL);
102 * }
103 *
104 ***************************************/
105
106 static void utc_alarmdb_free_data_list_func_01()
107 {
108         if (adl) {
109                 alarmdb_free_data_list(adl);
110                 adl = NULL;
111         }
112         tet_result(TET_PASS);
113 }