From 83efb118c1bdcb7d44a1fa6b187eb33bf86f72dd Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Tue, 28 Oct 2008 18:25:54 -0400 Subject: Replaced Treap with OrderedDict. Updated regression_tests and extensions. All tests pass. Still needs documentation. --- treap_test.py | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 treap_test.py (limited to 'treap_test.py') 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', '