From 927eb99e75325164a541c2638e1e607294019381 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 17 Nov 2020 12:38:40 +0100 Subject: Complete hierarchical evaluation (unittest and systemtest fixed) --- tests/test-cpp.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test-cpp.cpp b/tests/test-cpp.cpp index 5755516..95d271d 100644 --- a/tests/test-cpp.cpp +++ b/tests/test-cpp.cpp @@ -80,16 +80,40 @@ TEST_F(CppTest, preprocessing_tokenize_compile_error) { FAIL() << "Exception expected"; } -TEST_F(CppTest, compile) { +TEST_F(CppTest, compile_1) { + CPP cpp; + + cpp.compile("int main() { return 1; }"); +} + +TEST_F(CppTest, compile_add) { CPP cpp; cpp.compile("int main() { return 1 + 2; }"); } -TEST_F(CppTest, compile_1) { +TEST_F(CppTest, compile_123) { CPP cpp; - cpp.compile("int main() { return 1; }"); + cpp.compile("int main() { return 1 + 2 + 3; }"); +} + +TEST_F(CppTest, compile_parentheses_left) { + CPP cpp; + + cpp.compile("int main() { return (3 + 1) + 2; }"); +} + +TEST_F(CppTest, compile_parentheses_right) { + CPP cpp; + + cpp.compile("int main() { return 3 + (1 + 2); }"); +} + +TEST_F(CppTest, compile_add_mul) { + CPP cpp; + + cpp.compile("int main() { return 1 + (2 * 2); }"); } TEST_F(CppTest, compile_2_times) { -- cgit v1.2.3