Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
7e64f067
Commit
7e64f067
authored
Nov 09, 2015
by
Francis Dupont
Browse files
[4088fd] Added hexstring parsing unit tests
parent
29282dfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/eval/tests/context_unittest.cc
View file @
7e64f067
...
...
@@ -172,6 +172,21 @@ TEST_F(EvalContextTest, hexstring) {
checkTokenHexString
(
tmp
,
"foo"
);
}
// Test the parsing of a hexstring terminal with an odd number of
// hexadecimal digits
TEST_F
(
EvalContextTest
,
oddHexstring
)
{
EvalContext
eval
;
EXPECT_NO_THROW
(
parsed_
=
eval
.
parseString
(
"untyped: 0X7"
));
EXPECT_TRUE
(
parsed_
);
ASSERT_EQ
(
1
,
eval
.
expression
.
size
());
TokenPtr
tmp
=
eval
.
expression
.
at
(
0
);
checkTokenHexString
(
tmp
,
"
\a
"
);
}
// Test the parsing of an equal expression
TEST_F
(
EvalContextTest
,
equal
)
{
EvalContext
eval
;
...
...
@@ -255,6 +270,10 @@ TEST_F(EvalContextTest, parseErrors) {
checkError
(
"'foo''bar'"
,
"<string>:1.6-10: syntax error, unexpected constant string, "
"expecting =="
);
checkError
(
"0x"
,
"<string>:1.1: syntax error, unexpected option code"
);
checkError
(
"0abc"
,
"<string>:1.1: syntax error, unexpected option code"
);
checkError
(
"== 'ab'"
,
"<string>:1.1-2: syntax error, unexpected =="
);
checkError
(
"'foo' =="
,
"<string>:1.9: syntax error, unexpected end of file"
);
...
...
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