# Copyright (c) 2020 Project CHIP Authors
#
# 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_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")

chip_test_suite("tests") {
  output_name = "libControllerTests"

  test_sources = []

  # Not supported on efr32.
  if (chip_device_platform != "efr32") {
    test_sources += [ "TestCommissionableNodeController.cpp" ]
  }

  if (chip_device_platform != "mbed" && chip_device_platform != "esp32") {
    test_sources += [
      "TestEventCaching.cpp",
      "TestEventChunking.cpp",
      "TestEventNumberCaching.cpp",
      "TestReadChunking.cpp",
      "TestServerCommandDispatch.cpp",
      "TestWriteChunking.cpp",
    ]

    # Not supported on efr32.
    if (chip_device_platform != "efr32") {
      test_sources += [ "TestCommissioningWindowOpener.cpp" ]
    }
  }

  cflags = [ "-Wconversion" ]

  public_deps = [
    "${chip_root}/src/app/common:cluster-objects",
    "${chip_root}/src/app/tests:helpers",
    "${chip_root}/src/controller",
    "${chip_root}/src/lib/core:string-builder-adapters",
    "${chip_root}/src/lib/support:test_utils",
    "${chip_root}/src/messaging/tests:helpers",
    "${chip_root}/src/transport/raw/tests:helpers",
  ]

  if (chip_device_platform != "mbed") {
    public_deps += [ "${chip_root}/src/controller/data_model" ]
  }
}
