Initial Import
[profile/ivi/bundle.git] / TC / unit / utc_ApplicationFW_bundle_get_count_func.c
1 /*
2  *  bundle
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22 #include <tet_api.h>
23 #include "bundle.h"
24
25 static void startup(void);
26 static void cleanup(void);
27
28 void (*tet_startup)(void) = startup;
29 void (*tet_cleanup)(void) = cleanup;
30
31 static void utc_ApplicationFW_bundle_get_count_func_01(void);
32 static void utc_ApplicationFW_bundle_get_count_func_02(void);
33
34 enum {
35         POSITIVE_TC_IDX = 0x01,
36         NEGATIVE_TC_IDX,
37 };
38
39 struct tet_testlist tet_testlist[] = {
40         { utc_ApplicationFW_bundle_get_count_func_01, POSITIVE_TC_IDX },
41         { utc_ApplicationFW_bundle_get_count_func_02, NEGATIVE_TC_IDX },
42         { NULL, 0 }
43 };
44
45 static void startup(void)
46 {
47 }
48
49 static void cleanup(void)
50 {
51 }
52
53 /**
54  * @brief Positive test case of bundle_get_count()
55  */
56 static void utc_ApplicationFW_bundle_get_count_func_01(void)
57 {
58         int r;
59         bundle *b = bundle_create();
60         if(!b) {
61                 tet_result(TET_UNINITIATED);
62                 return;
63         }
64         if(bundle_add(b, "a", "123")) {
65                 tet_result(TET_UNINITIATED);
66                 goto cleanup;
67         }
68         r = bundle_get_count(b);
69         if(1 != r) {
70                 tet_infoline("bundle_get_count() failed in positive test case");
71                 tet_result(TET_FAIL);
72                 goto cleanup;
73         }
74
75         tet_result(TET_PASS);
76
77 cleanup:
78         if(b) bundle_free(b);
79         return;
80 }
81
82 /**
83  * @brief Negative test case of ug_init bundle_get_count()
84  */
85 static void utc_ApplicationFW_bundle_get_count_func_02(void)
86 {
87         int r;
88         r = bundle_get_count(NULL);
89         if(0 != r) {
90                 tet_infoline("bundle_get_count() failed in negative test case");
91                 tet_result(TET_FAIL);
92                 goto cleanup;
93         }
94         tet_result(TET_PASS);
95
96 cleanup:
97         return;
98 }