示例#1
0
 def test_Preprocess6(self):
     self.assertTrue(True)
     self.assertEqual(
         51,
         reduceStringToSingleValue(
             insertBracketsForAllAdditions("1 + (2 * 3) + (4 * (5 + 6))")))
     self.assertEqual(
         46,
         reduceStringToSingleValue(
             insertBracketsForAllAdditions("2 * 3 + (4 * 5)")))
     self.assertEqual(
         1445,
         reduceStringToSingleValue(
             insertBracketsForAllAdditions("5 + (8 * 3 + 9 + 3 * 4 * 3)")))
     self.assertEqual(
         669060,
         reduceStringToSingleValue(
             insertBracketsForAllAdditions(
                 "5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))")))
     self.assertEqual(
         23340,
         reduceStringToSingleValue(
             insertBracketsForAllAdditions(
                 "((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2")))
示例#2
0
 def test_Preprocess8(self):
     self.assertEqual(
         " ( ( ( ( ( (8 + (8 * 4 ) )) + ( (7 + 3 ) * 5 ) ) + 4 ) + 4 ) + 7 ) ",
         insertBracketsForAllAdditions(
             "(8 + (8 * 4)) + (7 + 3 * 5) + 4 + 4 + 7"))
示例#3
0
 def test_Preprocess7(self):
     self.assertTrue(True)
     self.assertEqual("8 * ( ( 3 + 9 ) + 3 ) ",
                      insertBracketsForAllAdditions("8 * 3 + 9 + 3"))
示例#4
0
 def test_Preprocess5(self):
     self.assertTrue(True)
     self.assertEqual(" ( 4 + 6 ) * ( ( 2 + 3 ) )",
                      insertBracketsForAllAdditions("4 + 6 * ( 2 + 3 )"))
示例#5
0
 def test_Preprocess4(self):
     self.assertTrue(True)
     self.assertEqual("( ( ( 4 + 6 ) + 3 ) )",
                      insertBracketsForAllAdditions("( 4 + 6 + 3 )"))
示例#6
0
 def test_Preprocess1(self):
     self.assertTrue(True)
     self.assertEqual(" ( 6 + 3 ) ", insertBracketsForAllAdditions("6 + 3"))