[Request]Update Flora license version
[apps/home/libslp-alarm.git] / TC / unit / utc_alarmdb_get_data_list_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_data_list_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
49         alarmdb_id = alarmdb_add_data(ad);
50         if (alarmdb_id > -1)
51                 tet_printf("\n Succeed to add an alarm data");
52 }
53
54 static void cleanup()
55 {
56         tet_printf("\n TC End");
57         /* add your code here */
58         if (alarmdb_id > -1) {
59                 alarmdb_del_data(alarmdb_id);
60                 alarmdb_id = -1;
61         }
62         if (ad) {
63                 alarmdb_free_data(ad);
64                 ad = NULL;
65         }
66         alarmdb_fini();
67 }
68
69 /***************************************
70 * Add your callback function here
71 * if needed
72 ***************************************/
73
74 /***************************************
75 * add your Test Cases
76 * e.g.,
77 * static void utc_ApplicationLib_recurGetDayOfWeek_01()
78 * {
79 *   int ret;
80 *
81 *   ret = target_api();
82 *   if(ret == 1)
83 *       tet_result(TET_PASS);
84 *   else
85 *       tet_result(TET_FAIL);
86 * }
87 *
88 * static void utc_ApplicationLib_recurGetDayOfWeek_02()
89 * {
90 *       code..
91 *       condition1
92 *           tet_result(TET_PASS);
93 *       condition2
94 *           tet_result(TET_FAIL);
95 * }
96 *
97 ***************************************/
98
99 static void utc_alarmdb_get_data_list_by_author_func_01()
100 {
101         struct alarm_data_list *loc_ad_list = NULL;
102
103         loc_ad_list = alarmdb_get_data_list_by_author(AUTHOR_TIMER);
104         if (loc_ad_list != NULL)
105                 tet_result(TET_PASS);
106         else
107                 tet_result(TET_FAIL);
108 }
109
110 static void utc_alarmdb_get_data_list_by_author_func_02()
111 {
112         struct alarm_data_list *loc_ad_list = NULL;
113
114         loc_ad_list = alarmdb_get_data_list_by_author(ALARM_DB_AUTHOR_ALARM);
115         if (loc_ad_list == NULL)
116                 tet_result(TET_PASS);
117         else
118                 tet_result(TET_FAIL);
119 }