Initialize Tizen 2.3
[framework/appfw/pkgmgr-info.git] / TC / unit / utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func.c
1 /*
2  *  slp-pkgmgr
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>, Shobhit Srivastava <shobhit.s@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 <pkgmgr-info.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_pkgmgrinfo_pkginfo_get_pkginfo_func_01(void);
32 static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02(void);
33 static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03(void);
34
35
36 enum {
37         POSITIVE_TC_IDX = 0x01,
38         NEGATIVE_TC_IDX,
39 };
40
41 struct tet_testlist tet_testlist[] = {
42         {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_01, POSITIVE_TC_IDX},
43         {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02, NEGATIVE_TC_IDX},
44         {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03, NEGATIVE_TC_IDX},
45         {NULL, 0},
46 };
47
48 static void startup(void)
49 {
50 }
51
52 static void cleanup(void)
53 {
54 }
55
56 /**
57  * @brief Positive test case of pkgmgrinfo_pkginfo_get_pkginfo()
58  */
59 static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_01(void)
60 {
61         int r = 0;
62         pkgmgrinfo_pkginfo_h handle;
63         r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
64         if (r != PMINFO_R_OK) {
65                 tet_infoline
66                     ("pkgmgrinfo_pkginfo_get_pkginfo() failed in positive test case");
67                 tet_result(TET_FAIL);
68                 return;
69         }
70         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
71         tet_result(TET_PASS);
72 }
73
74 /**
75  * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkginfo()
76  */
77 static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02(void)
78 {
79         int r = 0;
80         r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", NULL);
81         if (r == PMINFO_R_OK) {
82                 tet_infoline
83                     ("pkgmgrinfo_pkginfo_get_pkginfo() failed in negative test case");
84                 tet_result(TET_FAIL);
85                 return;
86         }
87         tet_result(TET_PASS);
88 }
89
90 /**
91  * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkginfo()
92  */
93 static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03(void)
94 {
95         int r = 0;
96         pkgmgrinfo_pkginfo_h handle;
97         r = pkgmgrinfo_pkginfo_get_pkginfo(NULL, &handle);
98         if (r == PMINFO_R_OK) {
99                 tet_infoline
100                     ("pkgmgrinfo_pkginfo_get_pkginfo() failed in negative test case");
101                 tet_result(TET_FAIL);
102                 return;
103         }
104         tet_result(TET_PASS);
105 }