Commit 937b5a6f authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

clang compilation fix (now using C++ cast in option.cc, also added test)

parent c110fcc9
......@@ -213,14 +213,14 @@ std::string Option::toText(int indent /* =0 */ ) {
for (int i=0; i<indent; i++)
tmp << " ";
tmp << "type=" << type_ << ", len=" << data_len_ << ":";
tmp << "type=" << type_ << ", len=" << data_len_ << ": ";
for (unsigned int i=0; i<data_len_; i++) {
if (i) {
tmp << ":";
}
tmp << setfill('0') << setw(2) << hex
<< (unsigned short)(unsigned uint8_t)data_[offset_+i];
<< static_cast<unsigned short>(data_[offset_+i]);
}
// print suboptions
......
......@@ -265,3 +265,15 @@ TEST_F(OptionTest, addgetdel) {
}
}
TEST_F(OptionTest, toText) {
boost::shared_array<uint8_t> buf(new uint8_t[3]);
buf[0] = 0;
buf[1] = 0xf;
buf[2] = 0xff;
boost::shared_ptr<Option> opt(new Option(Option::V6, 258,
buf, 0, 3));
EXPECT_EQ("type=258, len=3: 00:0f:ff", opt->toText());
}
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