include(cmake_test/cmake_test)

ct_add_test(NAME "cpp_copy")
function("${cpp_copy}")
    include(cmakepp_lang/algorithm/copy)
    include(cmakepp_lang/algorithm/equal)

#    ct_add_section(NAME "Signature")
#        set(CMAKEPP_LANG_DEBUG_MODE ON)
#
#        ct_add_section(NAME "0th argument is desc")
#            cpp_copy(TRUE hi)
#            ct_assert_fails_as("Assertion: bool is convertible to desc failed.")
#        endfunction()
#
#        ct_add_section(NAME "Takes exactly 2 arguments.")
#            cpp_copy(result foo bar)
#            ct_assert_fails_as("Function takes 2 argument(s), but 3 was/were")
#        endfunction()
#    endfunction()

    ct_add_section(NAME "bool")
    function("${bool}")
        set(lhs TRUE)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "descriptions")
    function("${descriptions}")
        set(lhs "hello world")
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "floats")
    function("${floats}")
        set(lhs 3.14)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "ints")
    function("${ints}")
        set(lhs 42)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "lists")
    function("${lists}")
        set(lhs hello world)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "map")
    function("${map}")
        include(cmakepp_lang/map/map)
        cpp_map(CTOR lhs a_key a_value foo bar)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "objects")
    function("${objects}")
        include(cmakepp_lang/object/object)

        cpp_copy(rhs "${__CMAKEPP_LANG_OBJECT_SINGLETON__}")
        cpp_equal(result "${__CMAKEPP_LANG_OBJECT_SINGLETON__}" "${rhs}")
        ct_assert_equal(result TRUE)
        ct_assert_not_equal(__CMAKEPP_LANG_OBJECT_SINGLETON__ "${rhs}")
    endfunction()

    ct_add_section(NAME "types")
    function("${types}")
        set(lhs int)
        cpp_copy(rhs "${lhs}")
        cpp_equal(result "${lhs}" "${rhs}")
        ct_assert_equal(result TRUE)
    endfunction()
endfunction()
