Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
320f10a5
Commit
320f10a5
authored
May 07, 2013
by
Paul Selkirk
Browse files
[2522] more MINFO unit tests
parent
323d64cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dns/tests/rdata_minfo_unittest.cc
View file @
320f10a5
...
...
@@ -39,10 +39,26 @@ const char* const too_long_label = "01234567890123456789012345678901234567"
namespace
{
class
Rdata_MINFO_Test
:
public
RdataTest
{
p
ublic
:
p
rotected
:
Rdata_MINFO_Test
()
:
rdata_minfo
(
string
(
minfo_txt
)),
rdata_minfo2
(
string
(
minfo_txt2
))
{}
void
checkFromText_None
(
const
string
&
rdata_str
)
{
checkFromText
<
generic
::
MINFO
,
isc
::
Exception
,
isc
::
Exception
>
(
rdata_str
,
rdata_minfo
,
false
,
false
);
}
void
checkFromText_LexerError
(
const
string
&
rdata_str
)
{
checkFromText
<
generic
::
MINFO
,
InvalidRdataText
,
MasterLexer
::
LexerError
>
(
rdata_str
,
rdata_minfo
,
true
,
true
);
}
void
checkFromText_TooLongLabel
(
const
string
&
rdata_str
)
{
checkFromText
<
generic
::
MINFO
,
TooLongLabel
,
TooLongLabel
>
(
rdata_str
,
rdata_minfo
,
true
,
true
);
}
const
generic
::
MINFO
rdata_minfo
;
const
generic
::
MINFO
rdata_minfo2
;
};
...
...
@@ -54,24 +70,23 @@ TEST_F(Rdata_MINFO_Test, createFromText) {
EXPECT_EQ
(
Name
(
"root.example.com."
),
rdata_minfo2
.
getRmailbox
());
EXPECT_EQ
(
Name
(
"emailbox.example.com."
),
rdata_minfo2
.
getEmailbox
());
checkFromText_None
(
minfo_txt
);
}
TEST_F
(
Rdata_MINFO_Test
,
badText
)
{
// incomplete text
EXPECT_THROW
(
generic
::
MINFO
(
"root.example.com."
),
InvalidRdataText
);
checkFromText_LexerError
(
"root.example.com."
);
// number of fields (must be 2) is incorrect
EXPECT_THROW
(
generic
::
MINFO
(
"root.example.com. emailbox.example.com. "
"example.com."
),
InvalidRdataText
);
// bad rmailbox name
EXPECT_THROW
(
generic
::
MINFO
(
"root.example.com. emailbox.example.com."
+
string
(
too_long_label
)),
TooLongLabel
);
checkFromText_TooLongLabel
(
"root.example.com. emailbox.example.com."
+
string
(
too_long_label
));
// bad emailbox name
EXPECT_THROW
(
generic
::
MINFO
(
"root.example.com."
+
string
(
too_long_label
)
+
" emailbox.example.com."
),
TooLongLabel
);
checkFromText_TooLongLabel
(
"root.example.com."
+
string
(
too_long_label
)
+
" emailbox.example.com."
);
}
TEST_F
(
Rdata_MINFO_Test
,
createFromWire
)
{
...
...
@@ -107,6 +122,15 @@ TEST_F(Rdata_MINFO_Test, createFromLexer) {
EXPECT_EQ
(
0
,
rdata_minfo
.
compare
(
*
test
::
createRdataUsingLexer
(
RRType
::
MINFO
(),
RRClass
::
IN
(),
minfo_txt
)));
// test::createRdataUsingLexer() constructs relative to
// "example.org." origin.
EXPECT_EQ
(
0
,
generic
::
MINFO
(
"r.example.org. e.example.org."
).
compare
(
*
test
::
createRdataUsingLexer
(
RRType
::
MINFO
(),
RRClass
::
IN
(),
"r e"
)));
// Extra text at end of line
EXPECT_FALSE
(
test
::
createRdataUsingLexer
(
RRType
::
MINFO
(),
RRClass
::
IN
(),
"rmailbox.example.com. emailbox.example.com. extra.example.com."
));
}
TEST_F
(
Rdata_MINFO_Test
,
assignment
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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