diff --git a/bundle.json b/bundle.json index b733d959f77b1571557362debe2efd21b3b2745b..c6cf1043906942be16fcfd775a3afcaf70fe7aec 100644 --- a/bundle.json +++ b/bundle.json @@ -48,7 +48,9 @@ "name": "//third_party/sqlite:sqliteicu" } ], - "test": [] + "test": [ + "//third_party/sqlite/unittest:unittest" + ] } } } diff --git a/unittest/BUILD.gn b/unittest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d32df9e0f2357418455fbee7f9c4960736504e05 --- /dev/null +++ b/unittest/BUILD.gn @@ -0,0 +1,57 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/test.gni") +import("//build/ohos.gni") + +module_output_path = "third_party_sqlite/third_party_sqlite" + +############################################################################### +config("module_private_config") { + visibility = [ ":*" ] + + defines = [ + ] + cflags_c = [ + "-fvisibility=hidden", + "-Wno-implicit-fallthrough", + ] + if (target_os != "ios") { + ldflags = [ "-Wl,--exclude-libs,ALL" ] + } +} + +ohos_unittest("libsqlittest") { + module_out_path = module_output_path + + sources = [ + "./sqlite_test.cpp", + ] + + configs = [ ":module_private_config" ] + + external_deps = [ + "c_utils:utils", + "googletest:gtest_main", + ] + + deps = [ + "//third_party/sqlite:sqlite", + ] +} + +############################################################################### +group("unittest") { + testonly = true + + deps = [ ":libsqlittest" ] +} \ No newline at end of file diff --git a/unittest/sqlite_test.cpp b/unittest/sqlite_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9db03693e2054ed4f86967373eb13584396b149d --- /dev/null +++ b/unittest/sqlite_test.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include +#include + +#include + +#include "sqlite3sym.h" + +using namespace testing::ext; + +class LibSQLiteTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; + +void LibSQLiteTest::SetUpTestCase(void) +{ + mkdir("./sqlitetest", 0770); +} + +void LibSQLiteTest::TearDownTestCase(void) +{ +} + +void LibSQLiteTest::SetUp(void) +{ +} + +void LibSQLiteTest::TearDown(void) +{ +} + +/** + * @tc.name: Lib_SQLite_Test_001 + * @tc.desc: demo for LibSQLiteTest. + * @tc.type: FUNC + */ +HWTEST_F(LibSQLiteTest, Lib_SQLite_Test_001, TestSize.Level0) +{ +}