Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
7095d7a9
Commit
7095d7a9
authored
Nov 20, 2013
by
Geoff Lang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix enum names that were not updated in the tests.
Change-Id: Id1bb71d997e710028759a9e9a2e0b24e35f92fc4
parent
bd79517a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
67 additions
and
67 deletions
+67
-67
ExpressionLimit_test.cpp
tests/compiler_tests/ExpressionLimit_test.cpp
+1
-1
char_test.cpp
tests/preprocessor_tests/char_test.cpp
+1
-1
comment_test.cpp
tests/preprocessor_tests/comment_test.cpp
+1
-1
define_test.cpp
tests/preprocessor_tests/define_test.cpp
+18
-18
error_test.cpp
tests/preprocessor_tests/error_test.cpp
+1
-1
extension_test.cpp
tests/preprocessor_tests/extension_test.cpp
+7
-7
if_test.cpp
tests/preprocessor_tests/if_test.cpp
+15
-15
location_test.cpp
tests/preprocessor_tests/location_test.cpp
+8
-8
number_test.cpp
tests/preprocessor_tests/number_test.cpp
+1
-1
pragma_test.cpp
tests/preprocessor_tests/pragma_test.cpp
+2
-2
version_test.cpp
tests/preprocessor_tests/version_test.cpp
+12
-12
No files found.
tests/compiler_tests/ExpressionLimit_test.cpp
View file @
7095d7a9
...
@@ -145,7 +145,7 @@ protected:
...
@@ -145,7 +145,7 @@ protected:
const
char
*
source
,
const
char
*
source
,
int
compileOptions
,
int
compileOptions
,
const
char
*
expected_error
)
{
const
char
*
expected_error
)
{
bool
success
=
ShCompile
(
compiler
,
&
source
,
1
,
compileOptions
);
bool
success
=
ShCompile
(
compiler
,
&
source
,
1
,
compileOptions
)
!=
0
;
if
(
success
)
{
if
(
success
)
{
success
=
!
expected_error
;
success
=
!
expected_error
;
}
else
{
}
else
{
...
...
tests/preprocessor_tests/char_test.cpp
View file @
7095d7a9
...
@@ -82,7 +82,7 @@ TEST_P(CharTest, Identified)
...
@@ -82,7 +82,7 @@ TEST_P(CharTest, Identified)
// Everything else is invalid.
// Everything else is invalid.
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_CHARACTER
,
_
,
str
));
print
(
pp
::
Diagnostics
::
PP_
INVALID_CHARACTER
,
_
,
str
));
}
}
pp
::
Token
token
;
pp
::
Token
token
;
...
...
tests/preprocessor_tests/comment_test.cpp
View file @
7095d7a9
...
@@ -62,7 +62,7 @@ TEST_F(BlockCommentTest, UnterminatedComment)
...
@@ -62,7 +62,7 @@ TEST_F(BlockCommentTest, UnterminatedComment)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_COMMENT
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_COMMENT
,
_
,
_
));
pp
::
Token
token
;
pp
::
Token
token
;
mPreprocessor
.
lex
(
&
token
);
mPreprocessor
.
lex
(
&
token
);
...
...
tests/preprocessor_tests/define_test.cpp
View file @
7095d7a9
...
@@ -19,7 +19,7 @@ TEST_F(DefineTest, NonIdentifier)
...
@@ -19,7 +19,7 @@ TEST_F(DefineTest, NonIdentifier)
"2
\n
"
;
"2
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
UNEXPECTED_TOKEN
,
print
(
pp
::
Diagnostics
::
PP_
UNEXPECTED_TOKEN
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"2"
));
"2"
));
...
@@ -46,19 +46,19 @@ TEST_F(DefineTest, RedefinePredefined)
...
@@ -46,19 +46,19 @@ TEST_F(DefineTest, RedefinePredefined)
"1
\n
"
;
"1
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_REDEFINED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"__LINE__"
));
"__LINE__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_REDEFINED
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"__FILE__"
));
"__FILE__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_REDEFINED
,
pp
::
SourceLocation
(
0
,
5
),
pp
::
SourceLocation
(
0
,
5
),
"__VERSION__"
));
"__VERSION__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_REDEFINED
,
pp
::
SourceLocation
(
0
,
7
),
pp
::
SourceLocation
(
0
,
7
),
"GL_ES"
));
"GL_ES"
));
...
@@ -73,7 +73,7 @@ TEST_F(DefineTest, ReservedUnderScore1)
...
@@ -73,7 +73,7 @@ TEST_F(DefineTest, ReservedUnderScore1)
"__foo
\n
"
;
"__foo
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_NAME_RESERVED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_NAME_RESERVED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"__foo"
));
"__foo"
));
...
@@ -88,7 +88,7 @@ TEST_F(DefineTest, ReservedUnderScore2)
...
@@ -88,7 +88,7 @@ TEST_F(DefineTest, ReservedUnderScore2)
"foo__bar
\n
"
;
"foo__bar
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_NAME_RESERVED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_NAME_RESERVED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"foo__bar"
));
"foo__bar"
));
...
@@ -103,7 +103,7 @@ TEST_F(DefineTest, ReservedGL)
...
@@ -103,7 +103,7 @@ TEST_F(DefineTest, ReservedGL)
"GL_foo
\n
"
;
"GL_foo
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_NAME_RESERVED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_NAME_RESERVED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"GL_foo"
));
"GL_foo"
));
...
@@ -135,7 +135,7 @@ TEST_F(DefineTest, ObjRedefineInvalid)
...
@@ -135,7 +135,7 @@ TEST_F(DefineTest, ObjRedefineInvalid)
"(0)
\n
"
;
"(0)
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_REDEFINED
,
pp
::
SourceLocation
(
0
,
2
),
pp
::
SourceLocation
(
0
,
2
),
"foo"
));
"foo"
));
...
@@ -167,7 +167,7 @@ TEST_F(DefineTest, FuncRedefineInvalid)
...
@@ -167,7 +167,7 @@ TEST_F(DefineTest, FuncRedefineInvalid)
"( a )
\n
"
;
"( a )
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_REDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_REDEFINED
,
pp
::
SourceLocation
(
0
,
2
),
pp
::
SourceLocation
(
0
,
2
),
"foo"
));
"foo"
));
...
@@ -684,7 +684,7 @@ TEST_F(DefineTest, FuncMissingRightParen)
...
@@ -684,7 +684,7 @@ TEST_F(DefineTest, FuncMissingRightParen)
"
\n
"
;
"
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_UNTERMINATED_INVOCATION
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_UNTERMINATED_INVOCATION
,
pp
::
SourceLocation
(
0
,
2
),
pp
::
SourceLocation
(
0
,
2
),
"foo"
));
"foo"
));
...
@@ -703,15 +703,15 @@ TEST_F(DefineTest, FuncIncorrectArgCount)
...
@@ -703,15 +703,15 @@ TEST_F(DefineTest, FuncIncorrectArgCount)
"
\n
"
;
"
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_TOO_FEW_ARGS
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_TOO_FEW_ARGS
,
pp
::
SourceLocation
(
0
,
2
),
pp
::
SourceLocation
(
0
,
2
),
"foo"
));
"foo"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_TOO_FEW_ARGS
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_TOO_FEW_ARGS
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"foo"
));
"foo"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_TOO_MANY_ARGS
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_TOO_MANY_ARGS
,
pp
::
SourceLocation
(
0
,
4
),
pp
::
SourceLocation
(
0
,
4
),
"foo"
));
"foo"
));
...
@@ -752,19 +752,19 @@ TEST_F(DefineTest, UndefPredefined)
...
@@ -752,19 +752,19 @@ TEST_F(DefineTest, UndefPredefined)
"1
\n
"
;
"1
\n
"
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_UNDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_UNDEFINED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"__LINE__"
));
"__LINE__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_UNDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_UNDEFINED
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"__FILE__"
));
"__FILE__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_UNDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_UNDEFINED
,
pp
::
SourceLocation
(
0
,
5
),
pp
::
SourceLocation
(
0
,
5
),
"__VERSION__"
));
"__VERSION__"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
MACRO_PREDEFINED_UNDEFINED
,
print
(
pp
::
Diagnostics
::
PP_
MACRO_PREDEFINED_UNDEFINED
,
pp
::
SourceLocation
(
0
,
7
),
pp
::
SourceLocation
(
0
,
7
),
"GL_ES"
));
"GL_ES"
));
...
...
tests/preprocessor_tests/error_test.cpp
View file @
7095d7a9
...
@@ -86,7 +86,7 @@ TEST_F(ErrorTest, MissingNewline)
...
@@ -86,7 +86,7 @@ TEST_F(ErrorTest, MissingNewline)
EXPECT_CALL
(
mDirectiveHandler
,
EXPECT_CALL
(
mDirectiveHandler
,
handleError
(
pp
::
SourceLocation
(
0
,
1
),
" foo"
));
handleError
(
pp
::
SourceLocation
(
0
,
1
),
" foo"
));
// Error reported about EOF.
// Error reported about EOF.
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_DIRECTIVE
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_DIRECTIVE
,
_
,
_
));
preprocess
(
str
,
expected
);
preprocess
(
str
,
expected
);
}
}
tests/preprocessor_tests/extension_test.cpp
View file @
7095d7a9
...
@@ -61,7 +61,7 @@ TEST_F(ExtensionTest, MissingNewline)
...
@@ -61,7 +61,7 @@ TEST_F(ExtensionTest, MissingNewline)
EXPECT_CALL
(
mDirectiveHandler
,
EXPECT_CALL
(
mDirectiveHandler
,
handleExtension
(
pp
::
SourceLocation
(
0
,
1
),
"foo"
,
"bar"
));
handleExtension
(
pp
::
SourceLocation
(
0
,
1
),
"foo"
,
"bar"
));
// Error reported about EOF.
// Error reported about EOF.
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_DIRECTIVE
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_DIRECTIVE
,
_
,
_
));
preprocess
(
str
,
expected
);
preprocess
(
str
,
expected
);
}
}
...
@@ -93,11 +93,11 @@ TEST_P(InvalidExtensionTest, Identified)
...
@@ -93,11 +93,11 @@ TEST_P(InvalidExtensionTest, Identified)
}
}
static
const
ExtensionTestParam
kParams
[]
=
{
static
const
ExtensionTestParam
kParams
[]
=
{
{
"#extension
\n
"
,
pp
::
Diagnostics
::
INVALID_EXTENSION_DIRECTIVE
},
{
"#extension
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_EXTENSION_DIRECTIVE
},
{
"#extension 1
\n
"
,
pp
::
Diagnostics
::
INVALID_EXTENSION_NAME
},
{
"#extension 1
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_EXTENSION_NAME
},
{
"#extension foo bar
\n
"
,
pp
::
Diagnostics
::
UNEXPECTED_TOKEN
},
{
"#extension foo bar
\n
"
,
pp
::
Diagnostics
::
PP_
UNEXPECTED_TOKEN
},
{
"#extension foo :
\n
"
,
pp
::
Diagnostics
::
INVALID_EXTENSION_DIRECTIVE
},
{
"#extension foo :
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_EXTENSION_DIRECTIVE
},
{
"#extension foo : 1
\n
"
,
pp
::
Diagnostics
::
INVALID_EXTENSION_BEHAVIOR
},
{
"#extension foo : 1
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_EXTENSION_BEHAVIOR
},
{
"#extension foo : bar baz
\n
"
,
pp
::
Diagnostics
::
UNEXPECTED_TOKEN
}
{
"#extension foo : bar baz
\n
"
,
pp
::
Diagnostics
::
PP_
UNEXPECTED_TOKEN
}
};
};
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidExtensionTest
,
testing
::
ValuesIn
(
kParams
));
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidExtensionTest
,
testing
::
ValuesIn
(
kParams
));
tests/preprocessor_tests/if_test.cpp
View file @
7095d7a9
...
@@ -612,7 +612,7 @@ TEST_F(IfTest, MissingExpression)
...
@@ -612,7 +612,7 @@ TEST_F(IfTest, MissingExpression)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_EXPRESSION
,
print
(
pp
::
Diagnostics
::
PP_
INVALID_EXPRESSION
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"syntax error"
));
"syntax error"
));
...
@@ -627,7 +627,7 @@ TEST_F(IfTest, DivisionByZero)
...
@@ -627,7 +627,7 @@ TEST_F(IfTest, DivisionByZero)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
DIVISION_BY_ZERO
,
print
(
pp
::
Diagnostics
::
PP_
DIVISION_BY_ZERO
,
pp
::
SourceLocation
(
0
,
1
),
"1 / 0"
));
pp
::
SourceLocation
(
0
,
1
),
"1 / 0"
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -641,7 +641,7 @@ TEST_F(IfTest, ModuloByZero)
...
@@ -641,7 +641,7 @@ TEST_F(IfTest, ModuloByZero)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
DIVISION_BY_ZERO
,
print
(
pp
::
Diagnostics
::
PP_
DIVISION_BY_ZERO
,
pp
::
SourceLocation
(
0
,
1
),
"1 % 0"
));
pp
::
SourceLocation
(
0
,
1
),
"1 % 0"
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -655,7 +655,7 @@ TEST_F(IfTest, DecIntegerOverflow)
...
@@ -655,7 +655,7 @@ TEST_F(IfTest, DecIntegerOverflow)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INTEGER_OVERFLOW
,
print
(
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
,
pp
::
SourceLocation
(
0
,
1
),
"4294967296"
));
pp
::
SourceLocation
(
0
,
1
),
"4294967296"
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -669,7 +669,7 @@ TEST_F(IfTest, OctIntegerOverflow)
...
@@ -669,7 +669,7 @@ TEST_F(IfTest, OctIntegerOverflow)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INTEGER_OVERFLOW
,
print
(
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
,
pp
::
SourceLocation
(
0
,
1
),
"077777777777"
));
pp
::
SourceLocation
(
0
,
1
),
"077777777777"
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -683,7 +683,7 @@ TEST_F(IfTest, HexIntegerOverflow)
...
@@ -683,7 +683,7 @@ TEST_F(IfTest, HexIntegerOverflow)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INTEGER_OVERFLOW
,
print
(
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
,
pp
::
SourceLocation
(
0
,
1
),
"0xfffffffff"
));
pp
::
SourceLocation
(
0
,
1
),
"0xfffffffff"
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -697,11 +697,11 @@ TEST_F(IfTest, UndefinedMacro)
...
@@ -697,11 +697,11 @@ TEST_F(IfTest, UndefinedMacro)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_EXPRESSION
,
print
(
pp
::
Diagnostics
::
PP_
INVALID_EXPRESSION
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"syntax error"
));
"syntax error"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_UNEXPECTED_TOKEN
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_UNEXPECTED_TOKEN
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"UNDEFINED"
));
"UNDEFINED"
));
...
@@ -735,7 +735,7 @@ TEST_F(IfTest, ElseWithoutIf)
...
@@ -735,7 +735,7 @@ TEST_F(IfTest, ElseWithoutIf)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_ELSE_WITHOUT_IF
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_ELSE_WITHOUT_IF
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"else"
));
"else"
));
...
@@ -749,7 +749,7 @@ TEST_F(IfTest, ElifWithoutIf)
...
@@ -749,7 +749,7 @@ TEST_F(IfTest, ElifWithoutIf)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_ELIF_WITHOUT_IF
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_ELIF_WITHOUT_IF
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"elif"
));
"elif"
));
...
@@ -763,7 +763,7 @@ TEST_F(IfTest, EndifWithoutIf)
...
@@ -763,7 +763,7 @@ TEST_F(IfTest, EndifWithoutIf)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_ENDIF_WITHOUT_IF
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_ENDIF_WITHOUT_IF
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"endif"
));
"endif"
));
...
@@ -780,7 +780,7 @@ TEST_F(IfTest, ElseAfterElse)
...
@@ -780,7 +780,7 @@ TEST_F(IfTest, ElseAfterElse)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_ELSE_AFTER_ELSE
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_ELSE_AFTER_ELSE
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"else"
));
"else"
));
...
@@ -797,7 +797,7 @@ TEST_F(IfTest, ElifAfterElse)
...
@@ -797,7 +797,7 @@ TEST_F(IfTest, ElifAfterElse)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_ELIF_AFTER_ELSE
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_ELIF_AFTER_ELSE
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"elif"
));
"elif"
));
...
@@ -811,7 +811,7 @@ TEST_F(IfTest, UnterminatedIf)
...
@@ -811,7 +811,7 @@ TEST_F(IfTest, UnterminatedIf)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_UNTERMINATED
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_UNTERMINATED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"if"
));
"if"
));
...
@@ -825,7 +825,7 @@ TEST_F(IfTest, UnterminatedIfdef)
...
@@ -825,7 +825,7 @@ TEST_F(IfTest, UnterminatedIfdef)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
CONDITIONAL_UNTERMINATED
,
print
(
pp
::
Diagnostics
::
PP_
CONDITIONAL_UNTERMINATED
,
pp
::
SourceLocation
(
0
,
1
),
pp
::
SourceLocation
(
0
,
1
),
"ifdef"
));
"ifdef"
));
...
...
tests/preprocessor_tests/location_test.cpp
View file @
7095d7a9
...
@@ -77,7 +77,7 @@ TEST_F(LocationTest, ErrorLocationAfterComment)
...
@@ -77,7 +77,7 @@ TEST_F(LocationTest, ErrorLocationAfterComment)
const
char
*
str
=
"/*
\n\n
*/@"
;
const
char
*
str
=
"/*
\n\n
*/@"
;
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
NULL
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
NULL
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_CHARACTER
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
INVALID_CHARACTER
,
pp
::
SourceLocation
(
0
,
3
),
pp
::
SourceLocation
(
0
,
3
),
"@"
));
"@"
));
...
@@ -261,7 +261,7 @@ TEST_F(LocationTest, LineDirectiveMissingNewline)
...
@@ -261,7 +261,7 @@ TEST_F(LocationTest, LineDirectiveMissingNewline)
using
testing
::
_
;
using
testing
::
_
;
// Error reported about EOF.
// Error reported about EOF.
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_DIRECTIVE
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_DIRECTIVE
,
_
,
_
));
pp
::
Token
token
;
pp
::
Token
token
;
mPreprocessor
.
lex
(
&
token
);
mPreprocessor
.
lex
(
&
token
);
...
@@ -292,12 +292,12 @@ TEST_P(InvalidLineTest, Identified)
...
@@ -292,12 +292,12 @@ TEST_P(InvalidLineTest, Identified)
}
}
static
const
LineTestParam
kParams
[]
=
{
static
const
LineTestParam
kParams
[]
=
{
{
"#line
\n
"
,
pp
::
Diagnostics
::
INVALID_LINE_DIRECTIVE
},
{
"#line
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_LINE_DIRECTIVE
},
{
"#line foo
\n
"
,
pp
::
Diagnostics
::
INVALID_LINE_NUMBER
},
{
"#line foo
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_LINE_NUMBER
},
{
"#line 10 foo
\n
"
,
pp
::
Diagnostics
::
INVALID_FILE_NUMBER
},
{
"#line 10 foo
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_FILE_NUMBER
},
{
"#line 10 20 foo
\n
"
,
pp
::
Diagnostics
::
UNEXPECTED_TOKEN
},
{
"#line 10 20 foo
\n
"
,
pp
::
Diagnostics
::
PP_
UNEXPECTED_TOKEN
},
{
"#line 0xffffffff
\n
"
,
pp
::
Diagnostics
::
INTEGER_OVERFLOW
},
{
"#line 0xffffffff
\n
"
,
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
},
{
"#line 10 0xffffffff
\n
"
,
pp
::
Diagnostics
::
INTEGER_OVERFLOW
}
{
"#line 10 0xffffffff
\n
"
,
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
}
};
};
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidLineTest
,
testing
::
ValuesIn
(
kParams
));
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidLineTest
,
testing
::
ValuesIn
(
kParams
));
tests/preprocessor_tests/number_test.cpp
View file @
7095d7a9
...
@@ -20,7 +20,7 @@ TEST_P(InvalidNumberTest, InvalidNumberIdentified)
...
@@ -20,7 +20,7 @@ TEST_P(InvalidNumberTest, InvalidNumberIdentified)
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
ASSERT_TRUE
(
mPreprocessor
.
init
(
1
,
&
str
,
0
));
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_NUMBER
,
_
,
str
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
INVALID_NUMBER
,
_
,
str
));
pp
::
Token
token
;
pp
::
Token
token
;
mPreprocessor
.
lex
(
&
token
);
mPreprocessor
.
lex
(
&
token
);
...
...
tests/preprocessor_tests/pragma_test.cpp
View file @
7095d7a9
...
@@ -91,7 +91,7 @@ TEST_F(PragmaTest, MissingNewline)
...
@@ -91,7 +91,7 @@ TEST_F(PragmaTest, MissingNewline)
EXPECT_CALL
(
mDirectiveHandler
,
EXPECT_CALL
(
mDirectiveHandler
,
handlePragma
(
pp
::
SourceLocation
(
0
,
1
),
"foo"
,
"bar"
));
handlePragma
(
pp
::
SourceLocation
(
0
,
1
),
"foo"
,
"bar"
));
// Error reported about EOF.
// Error reported about EOF.
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_DIRECTIVE
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_DIRECTIVE
,
_
,
_
));
preprocess
(
str
,
expected
);
preprocess
(
str
,
expected
);
}
}
...
@@ -111,7 +111,7 @@ TEST_P(InvalidPragmaTest, Identified)
...
@@ -111,7 +111,7 @@ TEST_P(InvalidPragmaTest, Identified)
EXPECT_CALL
(
mDirectiveHandler
,
handlePragma
(
_
,
_
,
_
)).
Times
(
0
);
EXPECT_CALL
(
mDirectiveHandler
,
handlePragma
(
_
,
_
,
_
)).
Times
(
0
);
// Unrecognized pragma warning.
// Unrecognized pragma warning.
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
UNRECOGNIZED_PRAGMA
,
print
(
pp
::
Diagnostics
::
PP_
UNRECOGNIZED_PRAGMA
,
pp
::
SourceLocation
(
0
,
1
),
_
));
pp
::
SourceLocation
(
0
,
1
),
_
));
preprocess
(
str
,
expected
);
preprocess
(
str
,
expected
);
...
...
tests/preprocessor_tests/version_test.cpp
View file @
7095d7a9
...
@@ -57,7 +57,7 @@ TEST_F(VersionTest, MissingNewline)
...
@@ -57,7 +57,7 @@ TEST_F(VersionTest, MissingNewline)
EXPECT_CALL
(
mDirectiveHandler
,
EXPECT_CALL
(
mDirectiveHandler
,
handleVersion
(
pp
::
SourceLocation
(
0
,
1
),
200
));
handleVersion
(
pp
::
SourceLocation
(
0
,
1
),
200
));
// Error reported about EOF.
// Error reported about EOF.
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
EOF_IN_DIRECTIVE
,
_
,
_
));
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
PP_
EOF_IN_DIRECTIVE
,
_
,
_
));
preprocess
(
str
,
expected
);
preprocess
(
str
,
expected
);
}
}
...
@@ -104,7 +104,7 @@ TEST_F(VersionTest, AfterValidToken)
...
@@ -104,7 +104,7 @@ TEST_F(VersionTest, AfterValidToken)
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
VERSION_NOT_FIRST_STATEMENT
,
print
(
pp
::
Diagnostics
::
PP_
VERSION_NOT_FIRST_STATEMENT
,
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -122,10 +122,10 @@ TEST_F(VersionTest, AfterInvalidToken)
...
@@ -122,10 +122,10 @@ TEST_F(VersionTest, AfterInvalidToken)
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
INVALID_CHARACTER
,
print
(
pp
::
Diagnostics
::
PP_
INVALID_CHARACTER
,
pp
::
SourceLocation
(
0
,
1
),
"$"
));
pp
::
SourceLocation
(
0
,
1
),
"$"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
VERSION_NOT_FIRST_STATEMENT
,
print
(
pp
::
Diagnostics
::
PP_
VERSION_NOT_FIRST_STATEMENT
,
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -143,7 +143,7 @@ TEST_F(VersionTest, AfterValidDirective)
...
@@ -143,7 +143,7 @@ TEST_F(VersionTest, AfterValidDirective)
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
VERSION_NOT_FIRST_STATEMENT
,
print
(
pp
::
Diagnostics
::
PP_
VERSION_NOT_FIRST_STATEMENT
,
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -161,10 +161,10 @@ TEST_F(VersionTest, AfterInvalidDirective)
...
@@ -161,10 +161,10 @@ TEST_F(VersionTest, AfterInvalidDirective)
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
DIRECTIVE_INVALID_NAME
,
print
(
pp
::
Diagnostics
::
PP_
DIRECTIVE_INVALID_NAME
,
pp
::
SourceLocation
(
0
,
1
),
"foo"
));
pp
::
SourceLocation
(
0
,
1
),
"foo"
));
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
VERSION_NOT_FIRST_STATEMENT
,
print
(
pp
::
Diagnostics
::
PP_
VERSION_NOT_FIRST_STATEMENT
,
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
SourceLocation
(
0
,
2
),
_
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -184,7 +184,7 @@ TEST_F(VersionTest, AfterExcludedBlock)
...
@@ -184,7 +184,7 @@ TEST_F(VersionTest, AfterExcludedBlock)
using
testing
::
_
;
using
testing
::
_
;
EXPECT_CALL
(
mDiagnostics
,
EXPECT_CALL
(
mDiagnostics
,
print
(
pp
::
Diagnostics
::
VERSION_NOT_FIRST_STATEMENT
,
print
(
pp
::
Diagnostics
::
PP_
VERSION_NOT_FIRST_STATEMENT
,
pp
::
SourceLocation
(
0
,
4
),
_
));
pp
::
SourceLocation
(
0
,
4
),
_
));
pp
::
Token
token
;
pp
::
Token
token
;
...
@@ -220,10 +220,10 @@ TEST_P(InvalidVersionTest, Identified)
...
@@ -220,10 +220,10 @@ TEST_P(InvalidVersionTest, Identified)
}
}
static
const
VersionTestParam
kParams
[]
=
{
static
const
VersionTestParam
kParams
[]
=
{
{
"#version
\n
"
,
pp
::
Diagnostics
::
INVALID_VERSION_DIRECTIVE
},
{
"#version
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_VERSION_DIRECTIVE
},
{
"#version foo
\n
"
,
pp
::
Diagnostics
::
INVALID_VERSION_NUMBER
},
{
"#version foo
\n
"
,
pp
::
Diagnostics
::
PP_
INVALID_VERSION_NUMBER
},
{
"#version 100 foo
\n
"
,
pp
::
Diagnostics
::
UNEXPECTED_TOKEN
},
{
"#version 100 foo
\n
"
,
pp
::
Diagnostics
::
PP_
UNEXPECTED_TOKEN
},
{
"#version 0xffffffff
\n
"
,
pp
::
Diagnostics
::
INTEGER_OVERFLOW
}
{
"#version 0xffffffff
\n
"
,
pp
::
Diagnostics
::
PP_
INTEGER_OVERFLOW
}
};
};
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidVersionTest
,
testing
::
ValuesIn
(
kParams
));
INSTANTIATE_TEST_CASE_P
(
All
,
InvalidVersionTest
,
testing
::
ValuesIn
(
kParams
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment