Esempio n. 1
0
 def test_InteriorNode_postfixTest1(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 -"
     print(node3.postfix())
     self.assertEqual(node3.postfix(), s)
Esempio n. 2
0
 def test_InteriorNode_postfixTest2(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 /"
     self.assertEqual(node3.postfix(), s)