diff options
author | Waylan Limberg <waylan@gmail.com> | 2008-10-28 18:25:54 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2008-10-28 18:25:54 -0400 |
commit | 83efb118c1bdcb7d44a1fa6b187eb33bf86f72dd (patch) | |
tree | 1cfad9c53141ce33b871092f504c3d428568d805 /treap_test.py | |
parent | a7b2a0c6933b1c8667cd25a58a18e50be0367504 (diff) | |
download | markdown-83efb118c1bdcb7d44a1fa6b187eb33bf86f72dd.tar.gz markdown-83efb118c1bdcb7d44a1fa6b187eb33bf86f72dd.tar.bz2 markdown-83efb118c1bdcb7d44a1fa6b187eb33bf86f72dd.zip |
Replaced Treap with OrderedDict. Updated regression_tests and extensions. All tests pass. Still needs documentation.
Diffstat (limited to 'treap_test.py')
-rw-r--r-- | treap_test.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/treap_test.py b/treap_test.py deleted file mode 100644 index a1e2183..0000000 --- a/treap_test.py +++ /dev/null @@ -1,50 +0,0 @@ -from markdown import Treap - -if __name__ == '__main__': - from pprint import pprint - - def test(t, b): - if b is True: - print t, "Passed" - else: - print t, "Failed" - - print "Testing..." - r = Treap() - r.add('first', 'This', '_begin') - r.add('second', 'is', '>first') - r.add('fourth', 'self', '>second') - r.add('fifth', 'test', '>fourth') - r.add('third', 'a', '>second') - r['seventh'] = '.' - - print ".. Heapsort Test" - test('.... vals', r.heapsorted() == ['This', 'is', 'a', 'self', 'test','.']) - test('.... keys', r.heapsorted(keys=1) == ['first', 'second', 'third', 'fourth', 'fifth','seventh']) - test('.... items', r.heapsorted(items=1) == [('first', 'This'), ('second', 'is'), ('third', 'a'), ('fourth', 'self'), ('fifth', 'test'), ('seventh','.')]) - - print ".. Dict Storage Test" - r._reset() - test('.... vals', r.values() == r._vals) - r._reset() - test('.... keys', r.keys() == r._keys) - r._reset() - test('.... items', r.items() == r._items) - - print ".. Delete Node Test" - del r['second'] - test('.... vals', r.heapsorted() == ['This', 'a', 'self', 'test','.']) - test('.... keys', r.heapsorted(keys=1) == ['first', 'third', 'fourth', 'fifth','seventh']) - test('.... items', r.heapsorted(items=1) == [('first', 'This'), ('third', 'a'), ('fourth', 'self'), ('fifth', 'test'), ('seventh','.')]) - - print ".. Change value test." - r['seventh'] = 'CRAZY' - test('.... vals', r.heapsorted() == ['This', 'a', 'self', 'test','CRAZY']) - test('.... keys', r.heapsorted(keys=1) == ['first', 'third', 'fourth', 'fifth','seventh']) - test('.... items', r.heapsorted(items=1) == [('first', 'This'), ('third', 'a'), ('fourth', 'self'), ('fifth', 'test'), ('seventh','CRAZY')]) - print ".. Change priority test." - r.link('seventh', '<third') - test('.... vals', r.heapsorted() == ['This', 'a', 'self', 'CRAZY', 'test']) - test('.... keys', r.heapsorted(keys=1) == ['first', 'third', 'fourth','seventh', 'fifth']) - test('.... items', r.heapsorted(items=1) == [('first', 'This'), ('third', 'a'), ('fourth', 'self'), ('seventh','CRAZY'), ('fifth', 'test')]) - |