add a couple tests for the SplayList

This commit is contained in:
Mahmoud Hashemi 2013-05-26 22:46:54 -07:00
parent 9956cdf742
commit 07af82432e
1 changed files with 11 additions and 0 deletions

View File

@ -281,6 +281,17 @@ class SplayList(list):
# Tests # Tests
def test_splay():
splay = SplayList(xrange(10))
splay.swap(0, 9)
assert splay[0] == 9
assert splay[-1] == 0
splay.shift(-2)
assert splay[0] == 8
assert splay[-1] == 0
assert len(splay) == 10
def main(): def main():
import os import os