include(cmake_test/cmake_test)

ct_add_test(NAME "test_cpp_is_float")
function("${test_cpp_is_float}")
    include(cmakepp_lang/types/float)

    ct_add_section(NAME "test_signature" EXPECTFAIL)
    function("${test_signature}")
        cpp_is_float(return 3.14 hello)
    endfunction()

    ct_add_section(NAME "test_bool")
    function("${test_bool}")
        cpp_is_float(return TRUE)
        ct_assert_equal(return FALSE)
    endfunction()

    ct_add_section(NAME "test_class")
    function("${test_class}")
        include(cmakepp_lang/class/class)
        cpp_class(MyClass)

        cpp_is_float(return MyClass)
        ct_assert_equal(return FALSE)
    endfunction()

    ct_add_section(NAME "test_command")
    function("${test_command}")
        cpp_is_float(return add_subdirectory)
        ct_assert_equal(return FALSE)
    endfunction()

    ct_add_section(NAME "test_descriptions")
    function("${test_descriptions}")
        ct_add_section(NAME "description_without_float")
        function("${description_without_float}")
            cpp_is_float(return "Hello World")
            ct_assert_equal(return FALSE)
        endfunction()

        ct_add_section(NAME "description_contains_float")
        function("${description_contains_float}")
            cpp_is_float(return "Hello World 3.14")
            ct_assert_equal(return FALSE)
        endfunction()
    endfunction()

    ct_add_section(NAME "test_float")
    function("${test_float}")
        ct_add_section(NAME "test_positive")
        function("${test_positive}")
            cpp_is_float(return 3.14)
            ct_assert_equal(return TRUE)
        endfunction()

        ct_add_section(NAME "test_negative")
        function("${test_negative}")
            cpp_is_float(return -3.14)
            ct_assert_equal(return TRUE)
        endfunction()
    endfunction()

    ct_add_section(NAME "small_integer")
    function("${small_integer}")
        cpp_is_float(return 42)
        ct_assert_equal(return FALSE)
    endfunction()

    ct_add_section(NAME "big_integer")
    function("${big_integer}")
        cpp_is_float(return 123456789)
        ct_assert_equal(return FALSE)
    endfunction()

    ct_add_section(NAME "test_list")
    function("${test_list}")
        ct_add_section(NAME "normal_list")
        function("${normal_list}")
            cpp_is_float(return "hello;world")
            ct_assert_equal(return FALSE)
        endfunction()

        ct_add_section(NAME "list_of_floats")
        function("${list_of_floats}")
            cpp_is_float(return "1.23;2.34;3.45")
            ct_assert_equal(return FALSE)
        endfunction()
    endfunction()

    ct_add_section(NAME "test_map")
    function("${test_map}")
        include(cmakepp_lang/map/map)
        cpp_map(CTOR a_map)
        cpp_is_float(result a_map)
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "test_obj")
    function("${test_obj}")
        include(cmakepp_lang/object/object)
        cpp_is_float(result "${__CMAKEPP_LANG_OBJECT_SINGLETON__}")
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "test_path")
    function("${test_path}")
        ct_add_section(NAME "normal_path")
        function("${normal_path}")
            cpp_is_float(return "${CMAKE_CURRENT_LIST_DIR}")
            ct_assert_equal(return FALSE)
        endfunction()

        ct_add_section(NAME "path_containing_float")
        function("${path_containing_float}")
            cpp_is_float(return "${CMAKE_CURRENT_LIST_DIR}/3.14")
            ct_assert_equal(return FALSE)
        endfunction()
    endfunction()

    ct_add_section(NAME "test_target")
    function("${test_target}")
        ct_add_section(NAME "normal_target_name")
        function("${normal_target_name}")
            add_library(lib STATIC IMPORTED)
            cpp_is_float(return lib)
            ct_assert_equal(return FALSE)
        endfunction()

        ct_add_section(NAME "target_with_float")
        function("${target_with_float}")
            add_library(lib3.14 STATIC IMPORTED)
            cpp_is_float(return lib1)
            ct_assert_equal(return FALSE)
        endfunction()
    endfunction()

    ct_add_section(NAME "test_type")
    function("${test_type}")
        cpp_is_float(return bool)
        ct_assert_equal(return FALSE)
    endfunction()
endfunction()
