def testTwoStackFail(self): self.assertRaises(ZeroDivisionError, lambda: DijkstraTwoStack("1 / 0").evaluate())
def testTwoStack(self): self.assertEqual(1, DijkstraTwoStack("1").evaluate()) self.assertEqual(3, DijkstraTwoStack("1 + 2").evaluate()) self.assertEqual(14, DijkstraTwoStack("2 * ( 4 + 3 )").evaluate()) self.assertEqual(2, DijkstraTwoStack("2 * ( 4 - 3 )").evaluate()) self.assertEqual(101, DijkstraTwoStack("1 + ( ( 2 + 3 ) * ( 4 * 5 ) )").evaluate())
def testTwoStack3(self): self.assertRaises(BqsException, lambda: DijkstraTwoStack("(").evaluate())