|
@@ -13,7 +13,7 @@
|
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
// Note: This file tests both the rdata_encoder and rdata_reader. They are
|
|
|
-// tested together because they form kind the oposite sides of the same
|
|
|
+// tested together because they form kind the opposite sides of the same
|
|
|
// functionality.
|
|
|
|
|
|
#include <exceptions/exceptions.h>
|
|
@@ -104,8 +104,7 @@ void
|
|
|
renderNameField(MessageRenderer* renderer, bool additional_required,
|
|
|
const LabelSequence& labels, unsigned attributes)
|
|
|
{
|
|
|
- EXPECT_EQ(additional_required,
|
|
|
- (attributes & NAMEATTR_ADDITIONAL) != 0);
|
|
|
+ EXPECT_EQ(additional_required, (attributes & NAMEATTR_ADDITIONAL) != 0);
|
|
|
renderer->writeName(labels, (attributes & NAMEATTR_COMPRESSIBLE) != 0);
|
|
|
}
|
|
|
|
|
@@ -151,7 +150,7 @@ protected:
|
|
|
template<class DecoderStyle>
|
|
|
class RdataEncodeDecodeTest : public RdataSerializationTest {
|
|
|
public:
|
|
|
- // This helper test method constructs encodes the given list of RDATAs
|
|
|
+ // This helper test method encodes the given list of RDATAs
|
|
|
// (in rdata_list), and then iterates over the data, rendering the fields
|
|
|
// in the wire format. It then compares the wire data with the one
|
|
|
// generated by the normal libdns++ interface to see the encoding/decoding
|
|
@@ -286,8 +285,8 @@ public:
|
|
|
encoded_data.end());
|
|
|
}
|
|
|
|
|
|
- // If RRSIGs are given, we need to extract the list of the RRSIG lengths
|
|
|
- // and adjust encoded_data_ further.
|
|
|
+ // If RRSIGs are given, we need to extract the list of the RRSIG
|
|
|
+ // lengths and adjust encoded_data_ further.
|
|
|
vector<uint16_t> rrsiglen_list;
|
|
|
if (rrsig_count > 0) {
|
|
|
const size_t rrsig_len_size = rrsig_count * sizeof(uint16_t);
|
|
@@ -305,11 +304,11 @@ public:
|
|
|
additionalRequired(rrtype), _1, _2),
|
|
|
boost::bind(renderDataField, &renderer, _1, _2));
|
|
|
|
|
|
- // 2nd dummy name
|
|
|
- renderer.writeName(dummy_name2);
|
|
|
- // Finally, dump any RRSIGs in wire format.
|
|
|
- foreachRRSig(encoded_data, rrsiglen_list,
|
|
|
- boost::bind(renderDataField, &renderer, _1, _2));
|
|
|
+ // 2nd dummy name
|
|
|
+ renderer.writeName(dummy_name2);
|
|
|
+ // Finally, dump any RRSIGs in wire format.
|
|
|
+ foreachRRSig(encoded_data, rrsiglen_list,
|
|
|
+ boost::bind(renderDataField, &renderer, _1, _2));
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -410,9 +409,9 @@ public:
|
|
|
boost::bind(renderNameField, &renderer,
|
|
|
additionalRequired(rrtype), _1, _2),
|
|
|
boost::bind(renderDataField, &renderer, _1, _2));
|
|
|
- while (reader.next()) { }
|
|
|
+ while (reader.next()) {}
|
|
|
renderer.writeName(dummy_name2);
|
|
|
- while (reader.nextSig()) { }
|
|
|
+ while (reader.nextSig()) {}
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -601,7 +600,7 @@ addRdataCommon(const vector<ConstRdataPtr>& rrsigs) {
|
|
|
|
|
|
TYPED_TEST(RdataEncodeDecodeTest, addRdata) {
|
|
|
vector<ConstRdataPtr> rrsigs;
|
|
|
- this->addRdataCommon(rrsigs); // basic tests without RRSIGs (empty vector)
|
|
|
+ this->addRdataCommon(rrsigs); // basic tests without RRSIGs (empty vector)
|
|
|
|
|
|
// Test with RRSIGs (covered type doesn't always match, but the encoder
|
|
|
// doesn't check that)
|
|
@@ -798,7 +797,7 @@ TEST_F(RdataSerializationTest, badAddSIGRdata) {
|
|
|
// Test the result returns what it was constructed with.
|
|
|
TEST_F(RdataSerializationTest, readerResult) {
|
|
|
// Default constructor
|
|
|
- RdataReader::Result empty;
|
|
|
+ const RdataReader::Result empty;
|
|
|
// Everything should be at the "empty" values, type END
|
|
|
EXPECT_EQ(RdataReader::END, empty.type());
|
|
|
EXPECT_EQ(NULL, empty.data());
|
|
@@ -808,8 +807,9 @@ TEST_F(RdataSerializationTest, readerResult) {
|
|
|
EXPECT_FALSE(empty.compressible());
|
|
|
EXPECT_FALSE(empty.additional());
|
|
|
// Constructor from label sequence
|
|
|
- LabelSequence seq(Name("example.org"));
|
|
|
- RdataReader::Result compressible(seq, NAMEATTR_COMPRESSIBLE);
|
|
|
+ const Name name("example.org");
|
|
|
+ const LabelSequence seq(name);
|
|
|
+ const RdataReader::Result compressible(seq, NAMEATTR_COMPRESSIBLE);
|
|
|
EXPECT_EQ(RdataReader::NAME, compressible.type());
|
|
|
EXPECT_EQ(NULL, compressible.data());
|
|
|
EXPECT_EQ(0, compressible.size());
|
|
@@ -817,7 +817,7 @@ TEST_F(RdataSerializationTest, readerResult) {
|
|
|
EXPECT_TRUE(compressible);
|
|
|
EXPECT_TRUE(compressible.compressible());
|
|
|
EXPECT_FALSE(compressible.additional());
|
|
|
- RdataReader::Result incompressible(seq, NAMEATTR_ADDITIONAL);
|
|
|
+ const RdataReader::Result incompressible(seq, NAMEATTR_ADDITIONAL);
|
|
|
EXPECT_EQ(RdataReader::NAME, incompressible.type());
|
|
|
EXPECT_EQ(NULL, incompressible.data());
|
|
|
EXPECT_EQ(0, incompressible.size());
|
|
@@ -826,8 +826,8 @@ TEST_F(RdataSerializationTest, readerResult) {
|
|
|
EXPECT_FALSE(incompressible.compressible());
|
|
|
EXPECT_TRUE(incompressible.additional());
|
|
|
// Constructor from data
|
|
|
- uint8_t byte;
|
|
|
- RdataReader::Result data(&byte, 1);
|
|
|
+ const uint8_t byte = 0;
|
|
|
+ const RdataReader::Result data(&byte, 1);
|
|
|
EXPECT_EQ(RdataReader::DATA, data.type());
|
|
|
EXPECT_EQ(&byte, data.data());
|
|
|
EXPECT_EQ(1, data.size());
|