4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
25 static void startup(void);
26 static void cleanup(void);
28 void (*tet_startup)(void) = startup;
29 void (*tet_cleanup)(void) = cleanup;
31 static void utc_ApplicationFW_db_util_close_func_01(void);
32 static void utc_ApplicationFW_db_util_close_func_02(void);
34 static sqlite3* db_hd = NULL;
35 char* db_path = "/opt/test.db";
38 POSITIVE_TC_IDX = 0x01,
42 struct tet_testlist tet_testlist[] = {
43 { utc_ApplicationFW_db_util_close_func_01, POSITIVE_TC_IDX },
44 { utc_ApplicationFW_db_util_close_func_02, NEGATIVE_TC_IDX },
48 static void startup(void)
52 static void cleanup(void)
57 * @brief Positive test case of db_util_close()
59 static void utc_ApplicationFW_db_util_close_func_01(void)
63 r = db_util_open(db_path, &db_hd, 0);
65 tet_infoline("db_util_close() failed in positive test case");
70 r = db_util_close(db_hd);
72 tet_infoline("db_util_close() failed in positive test case");
82 * @brief Negative test case of ug_init db_util_close()
84 static void utc_ApplicationFW_db_util_close_func_02(void)
87 sqlite3_stmt *db_stmt = NULL;
91 r = db_util_open(db_path, &db_hd, 0);
93 tet_infoline("db_util_close() failed in negative test case");
98 r = sqlite3_prepare(db_hd, "create table test(id int);", -1, &db_stmt, NULL);
100 tet_infoline("db_util_close() failed in negative test case");
101 tet_result(TET_FAIL);
105 r = db_util_close(db_hd);
106 if (r == SQLITE_OK) {
107 tet_infoline("db_util_close() failed in negative test case");
108 tet_result(TET_FAIL);
112 tet_result(TET_PASS);