include(cmake_test/cmake_test)

ct_add_test(NAME assert_true)
function(${assert_true})
    include(cmake_test/asserts/true_false)

    ct_add_section(NAME test_truthy)
    function(${test_truthy})
        ct_add_section(NAME test_1)
        function(${test_1})
            set(is_1 1)
            ct_assert_true(is_1)
        endfunction()

        ct_add_section(NAME test_ON)
        function(${test_ON})
            set(is_on ON)
            ct_assert_true(is_on)
        endfunction()

        ct_add_section(NAME test_YES)
        function(${test_YES})
            set(is_yes YES)
            ct_assert_true(is_yes)
        endfunction()

        ct_add_section(NAME test_TRUE)
        function(${test_TRUE})
            set(is_true TRUE)
            ct_assert_true(is_true)
        endfunction()

        ct_add_section(NAME test_Y)
        function(${test_Y})
            set(is_y Y)
            ct_assert_true(is_y)
        endfunction()

        ct_add_section(NAME test_nonzero)
        function(${test_nonzero})
            set(is_non_zero_1 100)
            set(is_non_zero_2 1234)
            ct_assert_true(is_non_zero_1)
            ct_assert_true(is_non_zero_2)
        endfunction()

        ct_add_section(NAME test_nonfalsey_string)
        function(${test_nonfalsey_string})
            set(is_a_non_falsey_string "a non-falsey string")
            ct_assert_true(is_a_non_falsey_string)
        endfunction()
    endfunction()

    ct_add_section(NAME test_falsey)
    function(${test_falsey})
        ct_add_section(NAME test_0 EXPECTFAIL)
        function(${test_0})
            set(is_0 0)
            ct_assert_true(is_0)
        endfunction()

        ct_add_section(NAME test_OFF EXPECTFAIL)
        function(${test_OFF})
            set(is_off OFF)
            ct_assert_true(is_off)
        endfunction()

        ct_add_section(NAME test_NO EXPECTFAIL)
        function(${test_NO})
            set(is_no NO)
            ct_assert_true(is_no)
        endfunction()

        ct_add_section(NAME test_FALSE EXPECTFAIL)
        function(${test_FALSE})
            set(is_false FALSE)
            ct_assert_true(is_false)
        endfunction()

        ct_add_section(NAME test_N EXPECTFAIL)
        function(${test_N})
            set(is_n N)
            ct_assert_true(is_n)
        endfunction()

        ct_add_section(NAME test_IGNORE EXPECTFAIL)
        function(${test_IGNORE})
            set(is_ignore IGNORE)
            ct_assert_true(is_ignore)
        endfunction()

        ct_add_section(NAME test_NOTFOUND EXPECTFAIL)
        function(${test_NOTFOUND})
            set(is_notfound NOTFOUND)
            ct_assert_true(is_notfound)
        endfunction()

        ct_add_section(NAME test_empty_string EXPECTFAIL)
        function(${test_empty_string})
            set(is_empty_string "")
            ct_assert_true(is_empty_string)
        endfunction()

        ct_add_section(NAME test_ends_with_NOTFOUND EXPECTFAIL)
        function(${test_ends_with_NOTFOUND})
            set(ends_with_notfound "something-NOTFOUND")
            ct_assert_true(ends_with_notfound)
        endfunction()
    endfunction()
endfunction()

ct_add_test(NAME assert_false)
function(${assert_false})
    include(cmake_test/asserts/true_false)

    ct_add_section(NAME test_falsey)
    function(${test_falsey})
        ct_add_section(NAME test_0)
        function(${test_0})
            set(is_0 0)
            ct_assert_false(is_0)
        endfunction()

        ct_add_section(NAME test_OFF)
        function(${test_OFF})
            set(is_off OFF)
            ct_assert_false(is_off)
        endfunction()

        ct_add_section(NAME test_NO)
        function(${test_NO})
            set(is_no NO)
            ct_assert_false(is_no)
        endfunction()

        ct_add_section(NAME test_FALSE)
        function(${test_FALSE})
            set(is_false FALSE)
            ct_assert_false(is_false)
        endfunction()

        ct_add_section(NAME test_N)
        function(${test_N})
            set(is_n N)
            ct_assert_false(is_n)
        endfunction()

        ct_add_section(NAME test_IGNORE)
        function(${test_IGNORE})
            set(is_ignore IGNORE)
            ct_assert_false(is_ignore)
        endfunction()

        ct_add_section(NAME test_NOTFOUND)
        function(${test_NOTFOUND})
            set(is_notfound NOTFOUND)
            ct_assert_false(is_notfound)
        endfunction()

        ct_add_section(NAME test_empty_string)
        function(${test_empty_string})
            set(is_empty_string "")
            ct_assert_false(is_empty_string)
        endfunction()

        ct_add_section(NAME test_ends_with_NOTFOUND)
        function(${test_ends_with_NOTFOUND})
            set(ends_with_notfound "something-NOTFOUND")
            ct_assert_false(ends_with_notfound)
        endfunction()
    endfunction()

    ct_add_section(NAME test_truthy)
    function(${test_truthy})
        ct_add_section(NAME test_1 EXPECTFAIL)
        function(${test_1})
            set(is_1 1)
            ct_assert_false(is_1)
        endfunction()

        ct_add_section(NAME test_ON EXPECTFAIL)
        function(${test_ON})
            set(is_on ON)
            ct_assert_false(is_on)
        endfunction()

        ct_add_section(NAME test_YES EXPECTFAIL)
        function(${test_YES})
            set(is_yes YES)
            ct_assert_false(is_yes)
        endfunction()

        ct_add_section(NAME test_TRUE EXPECTFAIL)
        function(${test_TRUE})
            set(is_true TRUE)
            ct_assert_false(is_true)
        endfunction()

        ct_add_section(NAME test_Y EXPECTFAIL)
        function(${test_Y})
            set(is_y Y)
            ct_assert_false(is_y)
        endfunction()

        ct_add_section(NAME test_nonzero EXPECTFAIL)
        function(${test_nonzero})
            set(is_non_zero 100)
            ct_assert_false(is_non_zero)
        endfunction()

        ct_add_section(NAME test_nonfalsey_string EXPECTFAIL)
        function(${test_nonfalsey_string})
            set(is_a_non_falsey_string "a non-falsey string")
            ct_assert_false(is_a_non_falsey_string)
        endfunction()
    endfunction()
endfunction()
