Commit 89fcb0f0 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac871] avoid using a hardcoded magic number in a test case

parent 28c50de2
......@@ -58,7 +58,7 @@ TEST_F(TSIGRecordTest, getName) {
}
TEST_F(TSIGRecordTest, getLength) {
// 85 = 17 + 26 + 16 + 24
// 85 = 17 + 26 + 16 + 26
// len(www.example.com) = 17
// len(hmac-md5.sig-alg.reg.int) = 26
// len(MAC) = 16
......@@ -82,10 +82,9 @@ TEST_F(TSIGRecordTest, recordToWire) {
}
TEST_F(TSIGRecordTest, recordToOLongToWire) {
// Rendering the test record requires a room of 85 bytes (see the
// getLength test). By setting the limit to 84, it will fail, and
// the renderer will be marked as "truncated".
renderer.setLengthLimit(84);
// By setting the limit to "record length - 1", it will fail, and the
// renderer will be marked as "truncated".
renderer.setLengthLimit(test_record.getLength() - 1);
EXPECT_FALSE(renderer.isTruncated()); // not marked before render attempt
EXPECT_EQ(0, test_record.toWire(renderer));
EXPECT_TRUE(renderer.isTruncated());
......
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