Beispiel #1
0
 def test_08(self):
     self.assertEqual(quiz.constant_fold(('+', 'x', ('+', 'x', 'x'))),
                      ('+', 'x', ('+', 'x', 'x')))
Beispiel #2
0
 def test_06(self):
     self.assertEqual(quiz.constant_fold(('*', 'a', ('-', 'b', 0))),
                      ('*', 'a', 'b'))
Beispiel #3
0
 def test_07(self):
     self.assertEqual(quiz.constant_fold(('+', 1, ('*', 2, ('-', 3, 2)))),
                      3)
Beispiel #4
0
 def test_05(self):
     self.assertEqual(
         quiz.constant_fold(('+', 7, ('*', 'x', ('-', 7, ('+', 4, 3))))), 7)
Beispiel #5
0
 def test_04(self):
     self.assertEqual(
         quiz.constant_fold(('*', 1, ('+', 0, ('*', ('+', 'x', 0), 1)))),
         'x')
Beispiel #6
0
 def test_03(self):
     self.assertEqual(
         quiz.constant_fold(('+', 'a', ('+', ('*', 'b', 0), 'c'))),
         ('+', 'a', 'c'))
Beispiel #7
0
 def test_02(self):
     self.assertEqual(
         quiz.constant_fold(('+', 'a', ('+', ('*', ('+', 3, 5), 6), 'b'))),
         ('+', 'a', ('+', 48, 'b')))
Beispiel #8
0
 def test_01(self):
     self.assertEqual(
         quiz.constant_fold(
             ('+', 'a', ('+', 'b', ('+', ('+', 3, 5), 'c')))),
         ('+', 'a', ('+', 'b', ('+', 8, 'c'))))