Commit 7b872d11 authored by Krzysztof Chruściński's avatar Krzysztof Chruściński Committed by Fabio Baltieri
Browse files

tests: unit: util: Rework test structure for C++ testing



Rework test structure to handle C++ test in a better way. Similar
approach already applied in other tests which are executed for C
and C++. Getting rid of test.inc which due to non-standard extension
was not covered by complience check.

Signed-off-by: default avatarKrzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
parent e90d69f9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4,4 +4,9 @@ cmake_minimum_required(VERSION 3.20.0)

project(util)
find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE})
target_sources(testbinary PRIVATE main.c maincxx.cxx ${ZEPHYR_BASE}/lib/utils/dec.c)
target_sources(testbinary PRIVATE main.c ${ZEPHYR_BASE}/lib/utils/dec.c)

if(CONFIG_CPP)
  # When testing for C++ force test file C++ compilation
  set_source_files_properties(main.c ${ZEPHYR_BASE}/lib/utils/dec.c PROPERTIES LANGUAGE CXX)
endif()
+512 −206

File changed.

Preview size limit exceeded, changes collapsed.

tests/unit/util/maincxx.cxx

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019 Oticon A/S
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/ztest.h>
#include <zephyr/sys/util.h>
#include <string.h>

#include "test.inc"

tests/unit/util/test.inc

deleted100644 → 0
+0 −652

File deleted.

Preview size limit exceeded, changes collapsed.

+8 −3
Original line number Diff line number Diff line
tests:
  utilities.dec:
common:
  tags:
    - lib
    - utilities
tests:
  utilities.dec:
    type: unit
  utilities.dec.cpp:
    type: unit
    extra_configs:
      - CONFIG_CPP=y