---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

# https://embeddedartistry.com/blog/2019/2/25/unit-testing-and-reporting-on-a-build-server-using-ceedling-and-unity


:project:
  :use_exceptions: FALSE
  :use_test_preprocessor: TRUE
  :use_auxiliary_dependencies: TRUE
  :build_root: build
  :release_build: FALSE
  :test_file_prefix: test
  :which_ceedling: gem
  :default_tasks:
    - test:all

:environment:

:extension:
  :executable: .out

:paths:
  :test:
    - +:test/**
    - -:support
    - -:generated
  :source:
    - ../../src/**
    - ../../include
  :support:
    - support
    - generated

:defines:
  # in order to add common defines:
  #  1) remove the trailing [] from the :common: section
  #  2) add entries to the :common: section (e.g. :test: has TEST defined)
  :commmon: &common_defines # A nice typo, next to invisible :)
  :test:
    # - *common_defines
    - UNITY_INCLUDE_CONFIG_H
    - TEST
  :test_preprocess:
    # - *common_defines
    - TEST

:cmock:
  :defines:
    - CMOCK_MEM_DYNAMIC
    - TEST
    # - UNITY_INT_WIDTH=32
    # - UNITY_LONG_WIDTH=32
    # - UNITY_POINTER_WIDTH=32
  :mock_prefix: mock_
  :when_no_prototypes: :warn
  :enforce_strict_ordering: TRUE
  :plugins:
    - :ignore
    - :ignore_arg
    - :callback
    - :array
  :treat_as:
    uint8:    HEX8
    uint16:   HEX16
    uint32:   UINT32
    int8:     INT8
    bool:     UINT8

:gcov:
  :gcovr:
    # The root directory of your source files. Defaults to ".", the current directory.
    # File names are reported relative to this root. The report_root is the default report_include.
    :report_root: "../../"
  :reports:
    - HtmlDetailed
  :report_include: "^../../src/.*"
  :report_exclude: "^vendor.*|^build.*|^test.*|^lib.*|^.*_build.*"

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# required for math.h
:tools_test_linker:
  :arguments:
    - -lm
:tools_gcov_linker:
  :arguments:
    - -lm

# https://gist.github.com/austinglaser/cb91ba7bb864a2fc87f72e7dc838cd6e
:flags:
  :test:
    :compile:
      :*:
        - -Wall
        - -g0
        - -O3
        - -m32
    :link:
      :*:
        - -g0
        - -O3
        - -m32
  :gcov:
    :compile:
      :*:
        - -g0
        - -O3
        - -Wall
        - -m32
    :link:
      :*:
        - -g0
        - -O3
        - -m32


# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
  :placement: :end
  :flag: "${1}"  # or "-L ${1}" for example
  :common: &common_libraries []
  :test:
    - *common_libraries
  :release:
    - *common_libraries

:plugins:
  :load_paths:
    - "#{Ceedling.load_path}"
  :enabled:
    - stdout_pretty_tests_report
    - module_generator
    - xml_tests_report
    - gcov

# :test_runner:
#   :cmdline_args: true