diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_c_generator.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py index e98951c..a7e52e8 100644 --- a/tests/test_c_generator.py +++ b/tests/test_c_generator.py @@ -361,7 +361,13 @@ class TestCtoC(unittest.TestCase): src = 'int x = ' + src + ';' self._assert_ctoc_correct(src) - def test_flattened_binaryops(self): + def test_reduce_parentheses_binaryops(self): + c1 = 'int x = a + b + c + d;'; + self.assertEqual(self._run_c_to_c(c1), 'int x = ((a + b) + c) + d;\n') + self.assertEqual( + self._run_c_to_c(c1, reduce_parentheses=True), + 'int x = a + b + c + d;\n') + # codes with minimum number of (necessary) parenthesis: test_snippets = [ 'int x = a*b*c*d;', |