include(cmake_test/cmake_test)

ct_add_test("_cpp_class_get_bases")
    include(cmakepp_core/class/class)
    include(cmakepp_core/utilities/compare_lists)

    ct_add_section("Signature")
        _cpp_class_get_bases(hello world tree)
        ct_assert_fails_as("Function takes 2 argument(s), but 3 was/were")
    ct_end_section()

    ct_add_section("Only obj as a base")
        cpp_class(MyClass)
        _cpp_class_get_bases(MyClass bases)
        set(corr obj)
        cpp_compare_lists(result bases corr)
        ct_assert_equal(result TRUE)
    ct_end_section()

    ct_add_section("Multiple 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)
    ct_end_section()

    ct_add_section("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)
    ct_end_section()
ct_end_test()

ct_add_test("_cpp_class_set_bases")
    include(cmakepp_core/class/class)
    include(cmakepp_core/utilities/compare_lists)

    cpp_class(MyClass)

    ct_add_section("Signature")
        set(CMAKEPP_CORE_DEBUG_MODE ON)

        ct_add_section("0th argument must be a class")
            _cpp_class_set_bases(TRUE a_list)
            ct_assert_fails_as("Assertion: bool is convertible to class")
        ct_end_section()

        ct_add_section("1st argument must be a desc")
            _cpp_class_set_bases(MyClass TRUE)
            ct_assert_fails_as("Assertion: bool is convertible to desc failed.")
        ct_end_section()
    ct_end_section()

    ct_add_section("Overwrites previous value")
        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)
    ct_end_section()
ct_end_test()
