apply FSL(Flora Software License)
[apps/core/preloaded/libslp-alarm.git] / TC / unit / utc_alarmdb_get_data_list_by_author_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_get_data_list_by_author_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         ad->author = AUTHOR_TIMER;
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_get_data_list_by_author_func_01()
98 {
99         struct alarm_data_list *loc_ad_list = NULL;
100
101         loc_ad_list = alarmdb_get_data_list_by_author(AUTHOR_TIMER);
102         if (loc_ad_list != NULL)
103                 tet_result(TET_PASS);
104         else
105                 tet_result(TET_FAIL);
106 }
107
108 static void utc_alarmdb_get_data_list_by_author_func_02()
109 {
110         struct alarm_data_list *loc_ad_list = NULL;
111
112         loc_ad_list = alarmdb_get_data_list_by_author(ALARM_DB_AUTHOR_ALARM);
113         if (loc_ad_list == NULL)
114                 tet_result(TET_PASS);
115         else
116                 tet_result(TET_FAIL);
117 }