# 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("${chip_root}/build/chip/chip_test_suite.gni")

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

  test_sources = [
    "TestEventLoopHandler.cpp",
    "TestSystemClock.cpp",
    "TestSystemErrorStr.cpp",
    "TestSystemPacketBuffer.cpp",
    "TestSystemScheduleLambda.cpp",
    "TestSystemTimer.cpp",
    "TestSystemWakeEvent.cpp",
    "TestTimeSource.cpp",
  ]

  if (chip_device_platform != "fake") {
    test_sources += [ "TestSystemScheduleWork.cpp" ]
  }

  # SystemPacketBuffer on nrfconnect and openiotsdk uses LwIP buffers, which ignore the
  #  requested allocation size and always allocate at max-size.  So our test,
  #  which tries to size-limit the buffers, does not work correctly there.
  if (chip_device_platform != "nrfconnect" &&
      chip_device_platform != "openiotsdk") {
    test_sources += [ "TestTLVPacketBufferBackingStore.cpp" ]
  }

  cflags = [ "-Wconversion" ]

  public_deps = [
    "${chip_root}/src/inet",
    "${chip_root}/src/lib/core:string-builder-adapters",
    "${chip_root}/src/lib/support/tests:pw-test-macros",
    "${chip_root}/src/platform",
    "${chip_root}/src/system",
  ]
}
