def test_est_pair():
    # Tests pour la fonction est_pair
    for i in range(128):
        bits = list(map(int, list(bin(i)[2:])))
        expected = (i%2) == 0
        assert est_pair(bits) == expected, f"Le test suivant n'a pas été validé.\nEntrée : {bits}\nSortie : {est_pair(bits)}\nAttendu : {expected}"
    return True

# from tp import est_pair
# test_est_pair()
def test_est_plus_grand_kbits():
    # Tests pour la fonction est_plus_grand_kbits
    for i in range(1024):
        bits = list(map(int, list(bin(i)[2:])))
        reponse = est_plus_grand_kbits(bits) 
        expected = all(bits)
        assert reponse == expected, f"Le test suivant n'a pas été validé.\nEntrée : {bits}\nSortie : {reponse}\nAttendu : {expected}"
    return True

# test_est_plus_grand_kbits()
def test_base2_vers_base10():
    # Tests pour la fonction base2_vers_base10
    for i in range(128):
        bits = list(map(int, list(bin(i)[2:])))
        réponse = base2_vers_base10(bits)
        assert réponse == i, message(bits, réponse, i)
    return True

# from tp import base2_vers_base10
# test_base2_vers_base10()
import random
def test_appartient():
    # Tests pour la fonction appartient 
    assert appartient([], 0) == False
    assert appartient([0, 1, 2, 3], 0) == True
    assert appartient([0, 1, 2, 3], 3) == True
    assert appartient([0, 1, 2, 3], 4) == False
    return True

# from tp import appartient
# test_appartient()
def test_indices_occurrences():
    # Tests pour la fonction indices_occurrences
    assert indices_occurrences([], 0) == []
    assert indices_occurrences([0, 1, 2, 3], 0) == [0]
    assert indices_occurrences([0, 1, 2, 0], 0) == [0, 3]
    assert indices_occurrences([0, 1, 2, 3], 2) == [2]
    assert indices_occurrences([0, 1, 2, 3], 4) == []
    return True

# from tp import indices_occurrences
# test_indices_occurrences()
def test_occurrences():
    """ Tests pour la fonction occurrences """
    print("Tests de occurrences passés avec succès.")
    return True

# from tp import occurrences
# test_occurrences()
import random
def test_maximum():
    # Tests pour la fonction maximum
    assert maximum([1]) == (1, 0)
    assert maximum([1, 2, -1]) == (2, 1)
    assert maximum([1, 2, -1, 2]) == (2, 1)
    for _ in range(1000):
        tab = [random.randint(-10, 10) for _ in range(random.randint(1, 10))]
        expected = max(tab), tab.index(max(tab))
        assert maximum(tab) == expected, f"Le test suivant n'a pas été validé.\nEntrée : {tab }\nSortie : {maximum(tab)}\nAttendu : {expected}"
    return True

# from tp import maximum
# test_maximum()
def test_est_trie_croissant():
    """ Tests pour la fonction est_trie_croissant """
    print("Tests de est_trie_croissant passés avec succès.")
    return True

# from tp import est_trie_croissant
# test_est_trie_croissant()
