Beispiel #1
0
def test_tableau_dense():
    assert len(tableau_dense(5)) == 5
Beispiel #2
0
def assert_sorts(s, t):
    u = sorted(t)
    v = t.copy()
    s(v)
    assert v == u

tableaux = [
    [11, 22, 33],
    [11, 33, 22],
    [22, 11, 33],
    [22, 33, 11],
    [33, 11, 22],
    [33, 22, 11],
    tableau_croissant(N),
    tableau_decroissant(N),
    tableau_dense(N),
    tableau_aleatoire(N),
]

@pytest.mark.parametrize("t", tableaux)
def test_insertion(t):
    assert_sorts(tri_insertion, t)

@pytest.mark.parametrize("t", tableaux)
def test_insertion_opt(t):
    assert_sorts(tri_insertion_opt, t)

@pytest.mark.parametrize("t", tableaux)
def test_bentley_qsort(t):
    assert_sorts(tri_rapide_b, t)