Exemplo n.º 1
0
 def test_InteriorNode_infixTest2(self):
     leaf1 = LeafNode(72)
     leaf2 = LeafNode(14)
     node1 = InteriorNode(Token('+'), leaf1, leaf2)
     node2 = InteriorNode(Token('*'), leaf1, node1)
     node3 = InteriorNode(Token('/'), node2, leaf2)
     s = "((72 * (72 + 14)) / 14)"
     print(node3.infix())
     self.assertEqual(node3.infix(), s)
Exemplo n.º 2
0
 def test_InteriorNode_infixTest1(self):
     leaf1 = LeafNode(5)
     leaf2 = LeafNode(10)
     node1 = InteriorNode(Token('+'), leaf1, leaf2)
     node2 = InteriorNode(Token('*'), leaf1, node1)
     node3 = InteriorNode(Token('-'), node2, leaf2)
     s = "((5 * (5 + 10)) - 10)"
     self.assertEqual(node3.infix(), s)