#
# Copyright (c) 2012-2016 Krzysztof Jusiak (krzysztof at jusiak dot net)
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
include_directories(${CMAKE_CURRENT_LIST_DIR})

function(test test)
    string(REPLACE "/" "_" tmp ${test})
    add_executable(test.${tmp} ${CMAKE_CURRENT_LIST_DIR}/${test}.cpp)
    add_test(test.${tmp} test.${tmp})
endfunction()

if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_DI_NAMESPACE= -include common/test.hpp")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_DI_NAMESPACE= -include common/test.hpp")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FIcommon/test.hpp /D_CRT_SECURE_NO_WARNINGS /DBOOST_DI_NAMESPACE=")
endif()

test(ut/inject)
test(ut/aux_/preprocessor)
test(ut/aux_/type_traits)
test(ut/aux_/utility)
test(ut/concepts/boundable)
test(ut/concepts/callable)
test(ut/concepts/configurable)
test(ut/concepts/creatable)
test(ut/concepts/providable)
test(ut/concepts/scopable)
test(ut/core/any_type)
test(ut/core/array)
test(ut/core/binder)
test(ut/core/bindings)
test(ut/core/dependency)
test(ut/core/injector)
test(ut/core/policy)
test(ut/core/pool)
test(ut/core/provider)
test(ut/core/wrapper)
test(ut/policies/constructible)
test(ut/providers/heap)
test(ut/providers/stack_over_heap)
test(ut/scopes/deduce)
test(ut/scopes/instance)
test(ut/scopes/singleton)
test(ut/scopes/unique)
test(ut/type_traits/ctor_traits)
test(ut/type_traits/memory_traits)
test(ut/type_traits/named_traits)
test(ut/type_traits/rebind_traits)
test(ut/type_traits/scope_traits)
test(ut/wrappers/unique)
test(ut/wrappers/shared)
test(ut/bindings)
test(ut/config)
test(ut/injector)
test(ut/make_injector)

test(ft/di_bind)
test(ft/di_config)
test(ft/di_config_global_policies)
test(ft/di_config_global_provider)
test(ft/di_errors)
test(ft/di_inject)
test(ft/di_injector)
test(ft/di_no_memory_inc)
set_source_files_properties(ft/di_no_std_inc.cpp PROPERTIES COMPILE_FLAGS -DBOOST_DI_TEST_HPP)
test(ft/di_no_std_inc)

test(pt/di_compile_time)
set(CMAKE_BUILD_TYPE Release)
test(pt/di_run_time)

