test_optimize_advanced.py 922 B

123456789101112131415161718192021222324252627282930
  1. import unittest
  2. from src.optimize.advanced import eliminate_common_subexpressions, \
  3. fold_constants, copy_propagation
  4. from src.statement import Statement as S, Block as B
  5. class TestOptimizeAdvanced(unittest.TestCase):
  6. def setUp(self):
  7. self.foo = S('command', 'foo')
  8. self.bar = S('command', 'bar')
  9. def test_eliminate_common_subexpressions(self):
  10. pass
  11. def test_copy_propagation_true(self):
  12. # block = B([self.foo,
  13. # S('command', 'move', '$1', '$2'),
  14. # self.foo,
  15. # S('command', 'addu', '$3', '$1', '$4'),
  16. # self.bar])
  17. #
  18. # copy_propagation(block)
  19. # self.assertEquals(block.statements, [self.foo,
  20. # S('command', 'move', '$1', '$2'),
  21. # self.foo,
  22. # S('command', 'addu', '$3', '$2', '$4'),
  23. # self.bar])
  24. pass