More expression tests for division by zero.
git-svn-id: http://angleproject.googlecode.com/svn/trunk@1171 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/tests/preprocessor_tests/if_test.cpp b/tests/preprocessor_tests/if_test.cpp
index b7cc669..5696ebd 100644
--- a/tests/preprocessor_tests/if_test.cpp
+++ b/tests/preprocessor_tests/if_test.cpp
@@ -620,6 +620,34 @@
mPreprocessor.lex(&token);
}
+TEST_F(IfTest, DivisionByZero)
+{
+ const char* str = "#if 1 / (3 - (1 + 2))\n"
+ "#endif\n";
+ ASSERT_TRUE(mPreprocessor.init(1, &str, 0));
+
+ EXPECT_CALL(mDiagnostics,
+ print(pp::Diagnostics::DIVISION_BY_ZERO,
+ pp::SourceLocation(0, 1), "1 / 0"));
+
+ pp::Token token;
+ mPreprocessor.lex(&token);
+}
+
+TEST_F(IfTest, ModuloByZero)
+{
+ const char* str = "#if 1 % (3 - (1 + 2))\n"
+ "#endif\n";
+ ASSERT_TRUE(mPreprocessor.init(1, &str, 0));
+
+ EXPECT_CALL(mDiagnostics,
+ print(pp::Diagnostics::DIVISION_BY_ZERO,
+ pp::SourceLocation(0, 1), "1 % 0"));
+
+ pp::Token token;
+ mPreprocessor.lex(&token);
+}
+
TEST_F(IfTest, UndefinedMacro)
{
const char* str = "#if UNDEFINED\n"