1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15NFC_DIR = "../../" 16 17config("hdf_nfc_unit_test_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 "$NFC_DIR/hdi_service", 22 "$NFC_DIR/vendor_adaptor", 23 "$NFC_DIR/test/unittest/mock", 24 ] 25 26 cflags_cc = [ "-fexceptions" ] 27 cflags = [ "--coverage" ] 28 ldflags = [ "--coverage" ] 29} 30 31unit_test_deps = [ 32 "$NFC_DIR/hdi_service:libnfc_interface_service_1.1", 33 "$NFC_DIR/vendor_adaptor:nfc_vendor_adaptor", 34] 35 36unit_test_external_deps = [ 37 "c_utils:utils", 38 "drivers_interface_nfc:libnfc_stub_1.1", 39 "drivers_interface_nfc:nfc_idl_headers", 40 "hdf_core:libhdf_host", 41 "hdf_core:libhdf_ipc_adapter", 42 "hdf_core:libhdf_utils", 43 "hdf_core:libhdi", 44 "hilog:libhilog", 45 "ipc:ipc_single", 46] 47 48test_out_path = "drivers_peripheral_nfc/drivers_peripheral_nfc" 49 50ohos_unittest("nfc_impl_test") { 51 module_out_path = test_out_path 52 53 sources = [ 54 "$NFC_DIR/test/unittest/mock/mock.cpp", 55 "nfc_impl_test/nfc_impl_test.cpp", 56 ] 57 58 configs = [ ":hdf_nfc_unit_test_config" ] 59 60 deps = unit_test_deps 61 62 external_deps = unit_test_external_deps 63 64 part_name = "drivers_peripheral_nfc" 65 subsystem_name = "hdf" 66} 67 68ohos_unittest("nfc_impl_mock_test") { 69 module_out_path = test_out_path 70 71 sources = [ "nfc_impl_mock_test/nfc_impl_mock_test.cpp" ] 72 73 configs = [ ":hdf_nfc_unit_test_config" ] 74 75 deps = unit_test_deps 76 77 external_deps = unit_test_external_deps 78 79 part_name = "drivers_peripheral_nfc" 80 subsystem_name = "hdf" 81} 82 83ohos_unittest("nfc_vendor_adaptions_test") { 84 module_out_path = test_out_path 85 86 sources = [ "nfc_vendor_adaptions_test/nfc_vendor_adaptions_test.cpp" ] 87 88 configs = [ ":hdf_nfc_unit_test_config" ] 89 90 deps = unit_test_deps 91 92 external_deps = unit_test_external_deps 93 94 part_name = "drivers_peripheral_nfc" 95 subsystem_name = "hdf" 96} 97 98group("hdf_nfc_unittest") { 99 testonly = true 100 101 deps = [ 102 ":nfc_impl_mock_test", 103 ":nfc_impl_test", 104 ":nfc_vendor_adaptions_test", 105 ] 106} 107