include(cmake_test/cmake_test)

ct_add_test(NAME "test_cpp_compare_lists")
function("${test_cpp_compare_lists}")
    include(cmakepp_lang/utilities/compare_lists)

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

        ct_add_section(NAME "first_arg_desc" EXPECTFAIL)
        function("${first_arg_desc}")
            cpp_compare_lists(TRUE a_list b_list)
        endfunction()

        ct_add_section(NAME "second_arg_desc" EXPECTFAIL)
        function("${second_arg_desc}")
            cpp_compare_lists(result TRUE b_list)
        endfunction()

        ct_add_section(NAME "third_arg_desc" EXPECTFAIL)
        function("${third_arg_desc}")
            cpp_compare_lists(result a_list TRUE)
        endfunction()

        ct_add_section(NAME "takes_three_args" EXPECTFAIL)
        function("${takes_three_args}")
            set(a_list hello world)
            set(b_list foo bar)
            cpp_compare_lists(result "${a_list}" "${b_list}")
        endfunction()
    endfunction()

    ct_add_section(NAME "empty_lists")
    function("${empty_lists}")
        set(a_empty_list)
        set(another_empty_list)
        cpp_compare_lists(result a_empty_list another_empty_list)
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "single_empty_list")
    function("${single_empty_list}")
        set(a_empty_list)
        set(a_list hello world)
        cpp_compare_lists(result a_empty_list a_list)
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "nonempty_diff_sized_lists")
    function("${nonempty_diff_sized_lists}")
        set(a_list 42)
        set(another_list hello world)
        cpp_compare_lists(result a_list another_list)
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "nonempty_same_sized_diff_contents")
    function("${nonempty_same_sized_diff_contents}")
        set(a_list foo bar)
        set(another_list hello world)
        cpp_compare_lists(result a_list another_list)
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "permutation_lists")
    function("${permutation_lists}")
        set(a_list foo bar)
        set(another_list bar foo)
        cpp_compare_lists(result a_list another_list)
        ct_assert_equal(result FALSE)
    endfunction()

    ct_add_section(NAME "same_lists")
    function("${same_lists}")
        set(a_list foo bar)
        set(another_list foo bar)
        cpp_compare_lists(result a_list another_list)
        ct_assert_equal(result TRUE)
    endfunction()
endfunction()
