include(cmake_test/cmake_test)

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

    ct_add_section(NAME "_get_bases_sig" EXPECTFAIL)
    function(${_get_bases_sig})
        _cpp_class_get_bases(hello world tree)
    endfunction()

    ct_add_section(NAME "_bases_obj")
    function(${_bases_obj})
        cpp_class(MyClass)
        _cpp_class_get_bases(MyClass bases)
        set(corr obj)
        cpp_compare_lists(result bases corr)
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "_bases_multi_inheritance")
    function(${_bases_multi_inheritance})
        cpp_class(BaseClass1)
        cpp_class(BaseClass2)
        cpp_class(MyClass BaseClass1 BaseClass2)
        _cpp_class_get_bases(MyClass bases)
        set(corr obj baseclass1 baseclass2)
        cpp_compare_lists(result bases corr)
        ct_assert_equal(result TRUE)
    endfunction()

    ct_add_section(NAME "_bases_deep_inheritance")
    function(${_bases_deep_inheritance})
        cpp_class(BaseBaseClass)
        cpp_class(BaseClass BaseBaseClass)
        cpp_class(MyClass BaseClass)
        _cpp_class_get_bases(MyClass bases)
        set(corr obj basebaseclass baseclass)
        cpp_compare_lists(result bases corr)
        ct_assert_equal(result TRUE)
    endfunction()
endfunction()

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

    cpp_class(MyClass)

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

        ct_add_section(NAME "_set_bases_sig_first_arg_class" EXPECTFAIL)
        function(${_set_bases_sig_first_arg_class})
            _cpp_class_set_bases(TRUE a_list)
        endfunction()

        ct_add_section(NAME "_set_bases_sig_second_arg_desc" EXPECTFAIL)
        function(${_set_bases_sig_second_arg_desc})
            _cpp_class_set_bases(MyClass TRUE)
        endfunction()
    endfunction()

    ct_add_section(NAME "_set_bases_overrides")
    function(${_set_bases_overrides})
        set(corr foo bar)
        _cpp_class_set_bases(MyClass corr)
        _cpp_class_get_bases(MyClass bases)
        cpp_compare_lists(result corr bases)
        ct_assert_equal(result TRUE)
    endfunction()
endfunction()
