summaryrefslogtreecommitdiffhomepage
path: root/tests/test-cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-cpp.cpp')
-rw-r--r--tests/test-cpp.cpp30
1 files changed, 27 insertions, 3 deletions
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) {