1# Copyright (c) 2022 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")
15
16IDL_DIR = "../../../.."
17
18config("idl_unittest_test_config") {
19  include_dirs = [
20    "../../common/",
21    "${IDL_DIR}/",
22  ]
23}
24
25common_sources = [
26  "${IDL_DIR}/ast/ast_array_type.cpp",
27  "${IDL_DIR}/ast/ast_boolean_type.cpp",
28  "${IDL_DIR}/ast/ast_byte_type.cpp",
29  "${IDL_DIR}/ast/ast_char_type.cpp",
30  "${IDL_DIR}/ast/ast_double_type.cpp",
31  "${IDL_DIR}/ast/ast_float_type.cpp",
32  "${IDL_DIR}/ast/ast_integer_type.cpp",
33  "${IDL_DIR}/ast/ast_interface_type.cpp",
34  "${IDL_DIR}/ast/ast_list_type.cpp",
35  "${IDL_DIR}/ast/ast_long_type.cpp",
36  "${IDL_DIR}/ast/ast_map_type.cpp",
37  "${IDL_DIR}/ast/ast_method.cpp",
38  "${IDL_DIR}/ast/ast_module.cpp",
39  "${IDL_DIR}/ast/ast_namespace.cpp",
40  "${IDL_DIR}/ast/ast_node.cpp",
41  "${IDL_DIR}/ast/ast_parameter.cpp",
42  "${IDL_DIR}/ast/ast_sequenceable_type.cpp",
43  "${IDL_DIR}/ast/ast_short_type.cpp",
44  "${IDL_DIR}/ast/ast_string_type.cpp",
45  "${IDL_DIR}/ast/ast_type.cpp",
46  "${IDL_DIR}/ast/ast_void_type.cpp",
47]
48
49common_sources += [
50  "${IDL_DIR}/codegen/code_emitter.cpp",
51  "${IDL_DIR}/codegen/code_generator.cpp",
52  "${IDL_DIR}/codegen/cpp_code_emitter.cpp",
53  "${IDL_DIR}/codegen/rust_code_emitter.cpp",
54  "${IDL_DIR}/codegen/ts_code_emitter.cpp",
55]
56
57common_sources += [
58  "${IDL_DIR}/metadata/metadata_builder.cpp",
59  "${IDL_DIR}/metadata/metadata_dumper.cpp",
60  "${IDL_DIR}/metadata/metadata_reader.cpp",
61  "${IDL_DIR}/metadata/metadata_serializer.cpp",
62]
63
64common_sources += [
65  "${IDL_DIR}/parser/lexer.cpp",
66  "${IDL_DIR}/parser/parser.cpp",
67]
68
69common_sources += [
70  "${IDL_DIR}/util/file.cpp",
71  "${IDL_DIR}/util/light_refcount_base.cpp",
72  "${IDL_DIR}/util/logger.cpp",
73  "${IDL_DIR}/util/options.cpp",
74  "${IDL_DIR}/util/string.cpp",
75  "${IDL_DIR}/util/string_builder.cpp",
76  "${IDL_DIR}/util/string_pool.cpp",
77]
78module_output_path = "idl/rust_unittest"
79
80ohos_unittest("code_emitter_test") {
81  module_out_path = module_output_path
82  configs = [ ":idl_unittest_test_config" ]
83  sources = [ "code_emitter_test.cpp" ]
84  sources += common_sources
85  external_deps = [ "bounds_checking_function:libsec_shared" ]
86}
87
88group("unittest") {
89  testonly = true
90  deps = [ ":code_emitter_test" ]
91}
92