예제 #1
0
def test_stringlist2(l):
    el = l[:-1]
    e = l[-1]
    sl = SortedList(el)
    assert (sorted(el) == sl._v)
    assert (sorted(el) == sl._k)

    sl.insert(e)
    assert (sorted(l) == sl._v)
    assert (sorted(l) == sl._k)

    sl.remove(e)
    assert (sorted(el) == sl._v)
    assert (sorted(el) == sl._k)
예제 #2
0
def test_stringlist2(l):
    el = l[:-1]
    e = l[-1]
    sl = SortedList(el)
    assert(sorted(el) == sl._v)
    assert(sorted(el) == sl._k)

    sl.insert(e)
    assert(sorted(l) == sl._v)
    assert(sorted(l) == sl._k)

    sl.remove(e)
    assert(sorted(el) == sl._v)
    assert(sorted(el) == sl._k)
예제 #3
0
def test_len():
    sl = SortedList([3, 6, 1, 7, 0])
    assert (len(sl) == 5)

    sl.insert(4)
    assert (len(sl) == 6)
예제 #4
0
def test_insert_duplicate():
    sl = SortedList([3, 6, 1, 7, 0])
    sl.insert(3)
    assert (sl._k == [0, 1, 3, 3, 6, 7])
    assert (sl._v == [0, 1, 3, 3, 6, 7])
예제 #5
0
def test_insert():
    sl = SortedList([3, 6, 1, 7, 0])
    sl.insert(4)
    assert (sl._k == [0, 1, 3, 4, 6, 7])
    assert (sl._v == [0, 1, 3, 4, 6, 7])
예제 #6
0
def test_len():
    sl = SortedList([3, 6, 1, 7, 0])
    assert(len(sl) == 5)

    sl.insert(4)
    assert(len(sl) == 6)
예제 #7
0
def test_insert_duplicate():
    sl = SortedList([3, 6, 1, 7, 0])
    sl.insert(3)
    assert(sl._k == [0, 1, 3, 3, 6, 7])
    assert(sl._v == [0, 1, 3, 3, 6, 7])
예제 #8
0
def test_insert():
    sl = SortedList([3, 6, 1, 7, 0])
    sl.insert(4)
    assert(sl._k == [0, 1, 3, 4, 6, 7])
    assert(sl._v == [0, 1, 3, 4, 6, 7])