aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_array.py
blob: 38759b9599c3c3dede96f73c006f92fdaf6a6660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from array import insert_position

def test_insert_position():
    assert insert_position(0, [], False) == 0
    assert insert_position(1, [1, 2, 3], False) == 0
    assert insert_position(2, [1, 2, 3], False) == 1
    assert insert_position(3, [1, 2, 3], False) == 2
    assert insert_position(8, [1, 2, 3], False) == 3
    assert insert_position(8, [3, 2, 1], True) == 0
    assert insert_position(3, [3, 2, 1], True) == 0
    assert insert_position(2, [3, 2, 1], True) == 1
    assert insert_position(1, [3, 2, 1], True) == 2