From 8d1e90282becddae24245c6c7c1a10479c06da9e Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 5 Oct 2020 06:32:52 -0700 Subject: Rename test and add lower-level testing --- tests/test_c_generator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/test_c_generator.py') 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;', -- cgit v1.2.1