# ====================  Define your project name (edit) ========================
set(project_name "iotmi_jobs_handler")

# =====================  Create your mock here  (edit)  ========================

list(APPEND mock_list
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/Jobs-for-AWS-IoT-embedded-sdk/source/include/jobs.h"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_adapter/source/include/iotmi_mqtt_adapter.h"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include/iotmi_pal_Heap.h"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include/iotmi_pal_SyncQueue.h"
)

list(APPEND mock_include_list
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/Jobs-for-AWS-IoT-embedded-sdk/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_adapter/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include"
)

list(APPEND mock_define_list
)

# ================= Create the library under test here (edit) ==================

list(APPEND real_source_files
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/jobs_handler/source/iotmi_jobs_handler.c"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/posix/source/iotmi_pal_Log.c"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/posix/source/iotmi_pal_Clock.c"
)

list(APPEND real_include_directories
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/Jobs-for-AWS-IoT-embedded-sdk/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_adapter/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/jobs_handler/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/sdk_log/source/include/logging"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/sdk_version/source/generated_include"
)

# =====================  Create UnitTest Code here (edit)  =====================

# list the directories your test needs to include
list(APPEND test_include_directories
    .
)

set(mock_name "${project_name}_mock")
set(real_name "${project_name}_real")

create_mock_list(
    "${mock_name}"
    "${mock_list}"
    "${MODULE_ROOT_DIR}/tools/cmock/project.yml"
    "${mock_include_list}"
    "${mock_define_list}"
)

create_real_library(
    "${real_name}"
    "${real_source_files}"
    "${real_include_directories}"
    "${mock_name}"
)

list(APPEND ${project_name}_utest_link_list ${mock_name} ${real_name})

list(APPEND ${project_name}_utest_dep_list ${real_name})

set(utest_name "${project_name}_utest")
set(utest_source "${CMAKE_CURRENT_SOURCE_DIR}/${project_name}_utest.c")
create_test(
    "${utest_name}"
    "${utest_source}"
    "${${project_name}_utest_link_list}"
    "${${project_name}_utest_dep_list}"
    "${test_include_directories}"
)

set_target_properties(${utest_name} PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests/unit-test" )
