Commit b57e4568 authored by Adam P. Goucher's avatar Adam P. Goucher

Bugfix

parent 60b46125
Pipeline #49836271 passed with stages
in 8 minutes and 17 seconds
......@@ -127,13 +127,17 @@ class RuleTree:
list_of_lines.append(' '.join(map(str,rule))+'\n')
return list_of_lines
def _treecompare(self, other, selfnode, othernode, memdict=set([])):
def _treecompare(self, other, selfnode, othernode, memdict=None):
if memdict is None:
memdict = set([])
if (selfnode, othernode) in memdict:
return True
sn = self.seq[selfnode]
on = other.seq[othernode]
lev = sn[0]
if lev == 1:
......
......@@ -23,8 +23,16 @@ class TestTreeduce(unittest.TestCase):
self.assertEqual(ruletree2[1], [(-1, -1), (1, 1), (0, -1), (-1, 0), (1, 0), (0, 1), (0, 0), (0, 0)])
self.assertEqual(len(ruletree2[2]), 27)
rt = parsetree.make_tree(*ruletree)
rt2 = parsetree.make_tree(*ruletree)
rt = parsetree.make_tree(*ruletree2)
rt2 = parsetree.make_tree(*ruletree2)
self.assertEqual(rt, rt2)
rt2._shrink(swap_at=5)
self.assertNotEqual(rt, rt2)
rt2._shrink(swap_at=3)
self.assertEqual(rt, rt2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment