Beispiel #1
0
def test_validar_se_a_palavra_e_um_palindromo_retorna_true():
    word = "ANA"
    assert is_palindrome_recursive(word, 0, len(word) - 1) is True
    word = "SOCOS"
    assert is_palindrome_recursive(word, 0, len(word) - 1) is True
    word = "REVIVER"
    assert is_palindrome_recursive(word, 0, len(word) - 1) is True
def is_recursive():
    sys.setrecursionlimit(100)
    try:
        word = "A" * 200
        is_palindrome_recursive(word, 0, len(word) - 1)
    except RecursionError:
        pass
    else:
        pytest.fail("O algoritimo deve ser recursivo.")
Beispiel #3
0
def test_validar_se_nao_passar_palavra_retorna_false():
    word = ""
    assert is_palindrome_recursive(word, 0, len(word) - 1) is False
Beispiel #4
0
def test_validar_se_a_palavra_nao_e_um_palindromo_retorna_false():
    word = "AGUA"
    assert is_palindrome_recursive(word, 0, len(word) - 1) is False