Added two POW test cases. The last one is still failing\!

parent bfd64e64
......@@ -39,3 +39,16 @@ class TestLine(unittest.TestCase):
l0, l1, l2 = Leaf(1), Leaf(2), Leaf(3)
plus = Node('+', l0, l1, l2)
self.assertEquals(generate_line(plus), '1 + 2 + 3')
def test_pow_basic(self):
a, b, c = Leaf('a'), Leaf('b'), Leaf('c')
node_pow = Node('^', a, Node('+', b, c))
self.assertEquals(generate_line(node_pow), 'a ^ (b + c)')
def test_pow_intermediate(self):
a, b, c, d, e = Leaf('a'), Leaf('b'), Leaf('c'), Leaf('d'), Leaf('e')
node_bc = Node('+', b, c)
node_de = Node('+', d, e)
node_mul = Node('*', a, node_bc)
node_pow = Node('^', node_mul, node_de)
self.assertEquals(generate_line(node_pow), 'a * (b + c) ^ (d + e)')
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