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

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

list(APPEND mock_list
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_agent/source/include/iotmi_device_MqttAgent.h"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include/iotmi_pal_Heap.h"
)

list(APPEND mock_include_list
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_agent/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_mqtt/coreMQTT/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_mqtt/coreMQTT/source/interface"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_pkcs11/corePKCS11/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_pkcs11/corePKCS11/source/dependency/3rdparty/pkcs11/published/2-40-errata-1"
    "${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/mqtt_adapter/source/iotmi_mqtt_adapter.c"
)

list(APPEND real_include_directories
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_agent/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_mqtt/coreMQTT/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_mqtt/coreMQTT/source/interface"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_pkcs11/corePKCS11/source/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/commonDependencies/core_pkcs11/corePKCS11/source/dependency/3rdparty/pkcs11/published/2-40-errata-1"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/platform/include"
    "${IOTMI_EMBEDDED_C_TOP_DIR}/components/mqtt_adapter/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(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" )
