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)
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)
def test_len(): sl = SortedList([3, 6, 1, 7, 0]) assert (len(sl) == 5) sl.insert(4) assert (len(sl) == 6)
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])
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])
def test_len(): sl = SortedList([3, 6, 1, 7, 0]) assert(len(sl) == 5) sl.insert(4) assert(len(sl) == 6)
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])
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])