def test_getitem(): random.seed(0) dl = DiskList() lst = list() for _ in range(100): val = random.random() dl.add(val) lst.append(val) assert all(dl[idx] == lst[idx] for idx in range(100)) assert all(dl[idx - 99] == lst[idx - 99] for idx in range(100)) dl.destroy()
def test_add(): random.seed(0) dl = DiskList() for val in range(10): dl.add(val) dl.destroy() dl = DiskList() for val in range(10, 0, -1): dl.add(val) dl.destroy() dl = DiskList() for val in range(10): dl.add(random.random()) dl.destroy()