Example #1
0
File: tests.py Project: Siuol39/spe
def test_tableau_decroissant():
    assert tableau_decroissant(5) == [5, 4, 3, 2, 1]
Example #2
0
File: tests.py Project: Siuol39/spe
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)