Commit fadc2058 by alokp@chromium.org

More expression tests for division by zero.

git-svn-id: https://angleproject.googlecode.com/svn/trunk@1171 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c6b3b3c7
...@@ -620,6 +620,34 @@ TEST_F(IfTest, MissingExpression) ...@@ -620,6 +620,34 @@ TEST_F(IfTest, MissingExpression)
mPreprocessor.lex(&token); 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) TEST_F(IfTest, UndefinedMacro)
{ {
const char* str = "#if UNDEFINED\n" const char* str = "#if UNDEFINED\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment