ocarina/tests/trees.py

42 lines
863 B
Python

# Bryan Schumaker (11/06/2010)
from libsaria import trees
#tree = trees.Tree()
#tree.insert(["home", "bjschuma", "Music"])
#tree.insert(["home", "bjschuma", "Videos"])
#tree.insert(["home", "other", "Music"])
#from libsaria import path
#tree = path.make_tree("/home/bjschuma/Music")
#print tree
#print tree.value
#tree.disp()
#for path in tree.walk():
# print path
#tree = trees.DLTree()
#n = tree.insert(["a", "b", "c", "d"])
#o = tree.insert(["a", "b", "c", "e"])
#p = tree.insert(["f", "g", "h", "i"])
#tree.disp()
#print n.walk_backwards()
#print o.walk_backwards()
#print p.walk_backwards()
tree = trees.DLFSTree()
n = tree.insert_path("/a/b/c/d")
o = tree.insert_path("/a/b/c/e")
p = tree.insert_path("/f/g/h/i")
for path in tree.walk_paths():
print path
print n.walk_path_backwards()
print o.walk_path_backwards()
print p.walk_path_backwards()