2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <notification.h>
26 #define TEST_PKG "org.tizen.tetware"
29 POSITIVE_TC_IDX = 0x01,
33 static void startup(void);
34 static void cleanup(void);
36 static void utc_notification_list_get_head_n(void);
37 static void utc_notification_list_get_head_p(void);
38 static void utc_notification_list_get_tail_n(void);
39 static void utc_notification_list_get_tail_p(void);
40 static void utc_notification_list_get_prev_n(void);
41 static void utc_notification_list_get_prev_p(void);
42 static void utc_notification_list_get_next_n(void);
43 static void utc_notification_list_get_next_p(void);
44 static void utc_notification_list_get_data_n(void);
45 static void utc_notification_list_get_data_p(void);
46 static void utc_notification_list_append_n(void);
47 static void utc_notification_list_append_p(void);
48 static void utc_notification_list_remove_n(void);
49 static void utc_notification_list_remove_p(void);
51 void (*tet_startup)(void) = startup;
52 void (*tet_cleanup)(void) = cleanup;
54 struct tet_testlist tet_testlist[] = {
55 {utc_notification_list_get_head_n, NEGATIVE_TC_IDX},
56 {utc_notification_list_get_head_p, POSITIVE_TC_IDX},
57 {utc_notification_list_get_tail_n, NEGATIVE_TC_IDX},
58 {utc_notification_list_get_tail_p, POSITIVE_TC_IDX},
59 {utc_notification_list_get_prev_n, NEGATIVE_TC_IDX},
60 {utc_notification_list_get_prev_p, POSITIVE_TC_IDX},
61 {utc_notification_list_get_next_n, NEGATIVE_TC_IDX},
62 {utc_notification_list_get_next_p, POSITIVE_TC_IDX},
63 {utc_notification_list_get_data_n, NEGATIVE_TC_IDX},
64 {utc_notification_list_get_data_p, POSITIVE_TC_IDX},
65 {utc_notification_list_append_n, NEGATIVE_TC_IDX},
66 {utc_notification_list_append_p, POSITIVE_TC_IDX},
67 {utc_notification_list_remove_n, NEGATIVE_TC_IDX},
68 {utc_notification_list_remove_p, POSITIVE_TC_IDX},
72 static void startup(void)
75 notifiation_clear(NOTIFICATION_TYPE_NONE);
76 tet_printf("\n TC start");
80 static void cleanup(void)
83 tet_printf("\n TC end");
87 * @brief Negative test case of notification_list_get_head()
89 static void utc_notification_list_get_head_n(void)
91 notification_list_h list = NULL;
92 notification_list_h list_value = NULL;
93 notification_h notification_1 = NULL;
94 notification_h notification_2 = NULL;
95 notification_h notification_3 = NULL;
96 notification_h notification_4 = NULL;
98 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
99 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
100 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
101 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
102 list = notification_list_append(list, notification_1);
103 list = notification_list_append(list, notification_2);
104 list = notification_list_append(list, notification_3);
105 list = notification_list_append(list, notification_4);
107 list_value = notification_list_get_head(NULL);
108 dts_check_eq("notification_list_get_head", list_value, NULL,
109 "Must return NULL in case of invalid parameter");
113 * @brief Positive test case of notification_list_get_head()
115 static void utc_notification_list_get_head_p(void)
117 notification_list_h list = NULL;
118 notification_list_h list_value = NULL;
119 notification_h notification_1 = NULL;
120 notification_h notification_2 = NULL;
121 notification_h notification_3 = NULL;
122 notification_h notification_4 = NULL;
124 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
125 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
126 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
127 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
128 list = notification_list_append(list, notification_1);
129 list = notification_list_append(list, notification_2);
130 list = notification_list_append(list, notification_3);
131 list = notification_list_append(list, notification_4);
133 /*Invalid parameter test*/
134 list_value = notification_list_get_head(list);
135 dts_check_ne("notification_list_get_head", list_value, NULL,
136 "Must return valid pointer in case of invalid parameter");
140 * @brief Negative test case of notification_list_get_tail()
142 static void utc_notification_list_get_tail_n(void)
144 notification_list_h list = NULL;
145 notification_list_h list_value = NULL;
146 notification_h notification_1 = NULL;
147 notification_h notification_2 = NULL;
148 notification_h notification_3 = NULL;
149 notification_h notification_4 = NULL;
151 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
152 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
153 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
154 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
155 list = notification_list_append(list, notification_1);
156 list = notification_list_append(list, notification_2);
157 list = notification_list_append(list, notification_3);
158 list = notification_list_append(list, notification_4);
160 list_value = notification_list_get_tail(NULL);
161 dts_check_eq("notification_list_get_tail", list_value, NULL,
162 "Must return NULL in case of invalid parameter");
166 * @brief Positive test case of notification_list_get_tail()
168 static void utc_notification_list_get_tail_p(void)
170 notification_list_h list = NULL;
171 notification_list_h list_value = NULL;
172 notification_h notification_1 = NULL;
173 notification_h notification_2 = NULL;
174 notification_h notification_3 = NULL;
175 notification_h notification_4 = NULL;
177 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
178 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
179 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
180 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
181 list = notification_list_append(list, notification_1);
182 list = notification_list_append(list, notification_2);
183 list = notification_list_append(list, notification_3);
184 list = notification_list_append(list, notification_4);
186 /*Invalid parameter test*/
187 list_value = notification_list_get_tail(list);
188 dts_check_ne("notification_list_get_tail", list_value, NULL,
189 "Must return valid pointer in case of invalid parameter");
193 * @brief Negative test case of notification_list_get_prev()
195 static void utc_notification_list_get_prev_n(void)
197 notification_list_h list = NULL;
198 notification_list_h list_value = NULL;
199 notification_h notification_1 = NULL;
200 notification_h notification_2 = NULL;
201 notification_h notification_3 = NULL;
202 notification_h notification_4 = NULL;
204 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
205 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
206 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
207 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
208 list = notification_list_append(list, notification_1);
209 list = notification_list_append(list, notification_2);
210 list = notification_list_append(list, notification_3);
211 list = notification_list_append(list, notification_4);
213 list_value = notification_list_get_prev(NULL);
214 dts_check_eq("notification_list_get_prev", list_value, NULL,
215 "Must return NULL in case of invalid parameter");
219 * @brief Positive test case of notification_list_get_prev()
221 static void utc_notification_list_get_prev_p(void)
223 notification_list_h list = NULL;
224 notification_list_h list_value = NULL;
225 notification_h notification_1 = NULL;
226 notification_h notification_2 = NULL;
227 notification_h notification_3 = NULL;
228 notification_h notification_4 = NULL;
230 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
231 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
232 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
233 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
234 list = notification_list_append(list, notification_1);
235 list = notification_list_append(list, notification_2);
236 list = notification_list_append(list, notification_3);
237 list = notification_list_append(list, notification_4);
239 /*Invalid parameter test*/
240 list = notification_list_get_tail(list);
241 list_value = notification_list_get_prev(list);
242 dts_check_ne("notification_list_get_prev", list_value, NULL,
243 "Must return valid pointer in case of invalid parameter");
247 * @brief Negative test case of notification_list_get_next()
249 static void utc_notification_list_get_next_n(void)
251 notification_list_h list = NULL;
252 notification_list_h list_value = NULL;
253 notification_h notification_1 = NULL;
254 notification_h notification_2 = NULL;
255 notification_h notification_3 = NULL;
256 notification_h notification_4 = NULL;
258 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
259 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
260 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
261 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
262 list = notification_list_append(list, notification_1);
263 list = notification_list_append(list, notification_2);
264 list = notification_list_append(list, notification_3);
265 list = notification_list_append(list, notification_4);
267 list_value = notification_list_get_next(NULL);
268 dts_check_eq("notification_list_get_next", list_value, NULL,
269 "Must return NULL in case of invalid parameter");
273 * @brief Positive test case of notification_list_get_next()
275 static void utc_notification_list_get_next_p(void)
277 notification_list_h list = NULL;
278 notification_list_h list_value = NULL;
279 notification_h notification_1 = NULL;
280 notification_h notification_2 = NULL;
281 notification_h notification_3 = NULL;
282 notification_h notification_4 = NULL;
284 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
285 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
286 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
287 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
288 list = notification_list_append(list, notification_1);
289 list = notification_list_append(list, notification_2);
290 list = notification_list_append(list, notification_3);
291 list = notification_list_append(list, notification_4);
293 /*Invalid parameter test*/
294 list = notification_list_get_head(list);
295 list_value = notification_list_get_next(list);
296 dts_check_ne("notification_list_get_next", list_value, NULL,
297 "Must return valid pointer in case of invalid parameter");
301 * @brief Negative test case of notification_list_get_data()
303 static void utc_notification_list_get_data_n(void)
305 notification_list_h list = NULL;
306 notification_h value = NULL;
307 notification_h notification_1 = NULL;
308 notification_h notification_2 = NULL;
309 notification_h notification_3 = NULL;
310 notification_h notification_4 = NULL;
312 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
313 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
314 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
315 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
316 list = notification_list_append(list, notification_1);
317 list = notification_list_append(list, notification_2);
318 list = notification_list_append(list, notification_3);
319 list = notification_list_append(list, notification_4);
321 value = notification_list_get_data(NULL);
322 dts_check_eq("notification_list_get_data", value, NULL,
323 "Must return NULL in case of invalid parameter");
327 * @brief Positive test case of notification_list_get_data()
329 static void utc_notification_list_get_data_p(void)
331 notification_list_h list = NULL;
332 notification_h value = NULL;
333 notification_h notification_1 = NULL;
334 notification_h notification_2 = NULL;
335 notification_h notification_3 = NULL;
336 notification_h notification_4 = NULL;
338 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
339 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
340 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
341 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
342 list = notification_list_append(list, notification_1);
343 list = notification_list_append(list, notification_2);
344 list = notification_list_append(list, notification_3);
345 list = notification_list_append(list, notification_4);
347 /*Invalid parameter test*/
348 value = notification_list_get_data(list);
349 dts_check_ne("notification_list_get_data", value, NULL,
350 "Must return valid pointer in case of invalid parameter");
354 * @brief Negative test case of notification_list_append()
356 static void utc_notification_list_append_n(void)
358 notification_list_h list = NULL;
359 notification_h notification_1 = NULL;
360 notification_h notification_2 = NULL;
361 notification_h notification_3 = NULL;
362 notification_h notification_4 = NULL;
364 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
365 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
366 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
367 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
368 list = notification_list_append(list, NULL);
369 dts_check_eq("notification_list_append", list, NULL,
370 "Must return NULL in case of invalid parameter");
374 * @brief Positive test case of notification_list_append()
376 static void utc_notification_list_append_p(void)
378 notification_list_h list = NULL;
379 notification_h notification_1 = NULL;
380 notification_h notification_2 = NULL;
381 notification_h notification_3 = NULL;
382 notification_h notification_4 = NULL;
384 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
385 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
386 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
387 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
388 list = notification_list_append(list, notification_1);
389 dts_check_ne("notification_list_append", list, NULL,
390 "Must return valid pointer in case of invalid parameter");
394 * @brief Negative test case of notification_list_remove()
396 static void utc_notification_list_remove_n(void)
398 notification_list_h list = NULL;
399 notification_h notification_1 = NULL;
400 notification_h notification_2 = NULL;
401 notification_h notification_3 = NULL;
402 notification_h notification_4 = NULL;
404 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
405 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
406 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
407 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
408 list = notification_list_append(list, notification_1);
409 list = notification_list_append(list, notification_2);
410 list = notification_list_append(list, notification_3);
411 list = notification_list_append(list, notification_4);
413 list = notification_list_remove(NULL, NULL);
414 dts_check_eq("notification_list_remove", list, NULL,
415 "Must return NULL in case of invalid parameter");
419 * @brief Positive test case of notification_list_remove()
421 static void utc_notification_list_remove_p(void)
423 notification_list_h list = NULL;
424 notification_h notification_1 = NULL;
425 notification_h notification_2 = NULL;
426 notification_h notification_3 = NULL;
427 notification_h notification_4 = NULL;
429 notification_1 = notification_create(NOTIFICATION_TYPE_NOTI);
430 notification_2 = notification_create(NOTIFICATION_TYPE_NOTI);
431 notification_3 = notification_create(NOTIFICATION_TYPE_NOTI);
432 notification_4 = notification_create(NOTIFICATION_TYPE_NOTI);
433 list = notification_list_append(list, notification_1);
434 list = notification_list_append(list, notification_2);
435 list = notification_list_append(list, notification_3);
436 list = notification_list_append(list, notification_4);
438 list = notification_list_remove(list, notification_1);
439 dts_check_ne("notification_list_remove", list, NULL,
440 "Must return valid pointer in case of invalid parameter");