include(cmake_test/cmake_test)

ct_add_test(NAME "test_cpp_map_equal")
function("${test_cpp_map_equal}")
    include(cmakepp_lang/map/map)

    ct_add_section(NAME "test_signature")
    function("${test_signature}")
        set(CMAKEPP_LANG_DEBUG_MODE ON)

        cpp_map(CTOR a_map)

        ct_add_section(NAME "first_arg_map" EXPECTFAIL)
        function("${first_arg_map}")
            cpp_map_equal(TRUE result "${a_map}")
        endfunction()

        ct_add_section(NAME "second_arg_map" EXPECTFAIL)
        function("${second_arg_map}")
            cpp_map_equal("${a_map}" TRUE "${a_map}")
        endfunction()

        ct_add_section(NAME "third_arg_map" EXPECTFAIL)
        function("${third_arg_map}")
            cpp_map_equal("${a_map}" result TRUE)
        endfunction()

        ct_add_section(NAME "accepts_three_args" EXPECTFAIL)
        function("${accepts_three_args}")
            cpp_map_equal("${a_map}" result "${a_map}" hello)
        endfunction()
    endfunction()

    ct_add_section(NAME "empty_equal_empty")
    function("${empty_equal_empty}")
        cpp_map(CTOR a_map)
        cpp_map(CTOR another_map)
        cpp_map(EQUAL "${a_map}" result "${another_map}")
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "filled_map")
    function("${filled_map}")
        cpp_map(CTOR a_map foo bar hello world)

        ct_add_section(NAME "diff_from_empty")
        function("${diff_from_empty}")
            cpp_map(CTOR another_map)
            cpp_map(EQUAL "${a_map}" result "${another_map}")
            ct_assert_equal(result FALSE)
        endfunction()

        ct_add_section(NAME "diff_keys")
        function("${diff_keys}")
            cpp_map(CTOR another_map foo1 bar hello1 world)
            cpp_map(EQUAL "${a_map}" result "${another_map}")
            ct_assert_equal(result FALSE)
        endfunction()

        ct_add_section(NAME "diff_vals")
        function("${diff_vals}")
            cpp_map(CTOR another_map foo bar1 hello world1)
            cpp_map(EQUAL "${a_map}" result "${another_map}")
            ct_assert_equal(result FALSE)
        endfunction()

        ct_add_section(NAME "same_vals_same_order")
        function("${same_vals_same_order}")
            cpp_map(CTOR another_map foo bar hello world)
            cpp_map(EQUAL "${a_map}" result "${another_map}")
            ct_assert_equal(result TRUE)
        endfunction()

        ct_add_section(NAME "same_vals_different_order")
        function("${same_vals_different_order}")
            cpp_map(CTOR another_map hello world foo bar)
            cpp_map(EQUAL "${a_map}" result "${another_map}")
            ct_assert_equal(result TRUE)
        endfunction()
    endfunction()
endfunction()
