# Copyright (c) 2022 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")

IDL_DIR = "../../../.."

config("idl_unittest_test_config") {
  include_dirs = [
    "../../common",
    "${IDL_DIR}/",
    "${IDL_DIR}/codegen/",
    "//utils/native/base/include/",
  ]
}

idl_common_sources = [
  "${IDL_DIR}/ast/ast_array_type.cpp",
  "${IDL_DIR}/ast/ast_boolean_type.cpp",
  "${IDL_DIR}/ast/ast_byte_type.cpp",
  "${IDL_DIR}/ast/ast_char_type.cpp",
  "${IDL_DIR}/ast/ast_double_type.cpp",
  "${IDL_DIR}/ast/ast_float_type.cpp",
  "${IDL_DIR}/ast/ast_integer_type.cpp",
  "${IDL_DIR}/ast/ast_interface_type.cpp",
  "${IDL_DIR}/ast/ast_list_type.cpp",
  "${IDL_DIR}/ast/ast_long_type.cpp",
  "${IDL_DIR}/ast/ast_map_type.cpp",
  "${IDL_DIR}/ast/ast_method.cpp",
  "${IDL_DIR}/ast/ast_module.cpp",
  "${IDL_DIR}/ast/ast_namespace.cpp",
  "${IDL_DIR}/ast/ast_node.cpp",
  "${IDL_DIR}/ast/ast_parameter.cpp",
  "${IDL_DIR}/ast/ast_sequenceable_type.cpp",
  "${IDL_DIR}/ast/ast_short_type.cpp",
  "${IDL_DIR}/ast/ast_string_type.cpp",
  "${IDL_DIR}/ast/ast_type.cpp",
  "${IDL_DIR}/ast/ast_void_type.cpp",
]

idl_common_sources += [
  "${IDL_DIR}/codegen/code_emitter.cpp",
  "${IDL_DIR}/codegen/code_generator.cpp",
  "${IDL_DIR}/codegen/cpp_code_emitter.cpp",
  "${IDL_DIR}/codegen/ts_code_emitter.cpp",
]

idl_common_sources += [
  "${IDL_DIR}/metadata/metadata_builder.cpp",
  "${IDL_DIR}/metadata/metadata_dumper.cpp",
  "${IDL_DIR}/metadata/metadata_reader.cpp",
  "${IDL_DIR}/metadata/metadata_serializer.cpp",
]

idl_common_sources += [
  "${IDL_DIR}/parser/lexer.cpp",
  "${IDL_DIR}/parser/parser.cpp",
]

idl_common_sources += [
  "${IDL_DIR}/util/file.cpp",
  "${IDL_DIR}/util/light_refcount_base.cpp",
  "${IDL_DIR}/util/logger.cpp",
  "${IDL_DIR}/util/options.cpp",
  "${IDL_DIR}/util/string.cpp",
  "${IDL_DIR}/util/string_builder.cpp",
  "${IDL_DIR}/util/string_pool.cpp",
]

module_output_path = "idl/ts_unittest"
ohos_unittest("ts_code_emitter_proxy_test") {
  module_out_path = module_output_path

  configs = [ ":idl_unittest_test_config" ]

  sources = [ "ts_code_emitter_proxy_test.cpp" ]
  sources += idl_common_sources

  deps = [
    "//third_party/googletest:gmock_main",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utilsecurec",
  ]
}

group("unittest") {
  testonly = true
  deps = [ ":ts_code_emitter_proxy_test" ]
}
