Commit 8d57d033 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

added more tests that currently fail (if 0'ed).


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@989 e5f2f494-b856-4b98-b285-d166d9295462
parent 404aa060
......@@ -33,14 +33,14 @@ namespace {
class HexTest : public ::testing::Test {
protected:
HexTest() {}
static const std::string hex_txt;
};
const std::string HexTest::hex_txt("DEADBEEFDECADE");
const std::string hex_txt("DEADBEEFDECADE");
const std::string hex_txt_lower("deadbeefdecade");
TEST_F(HexTest, encodeHex) {
std::vector<uint8_t>data;
std::string s;
std::vector<uint8_t> data;
data.push_back(0xde);
data.push_back(0xad);
data.push_back(0xbe);
......@@ -51,19 +51,34 @@ TEST_F(HexTest, encodeHex) {
EXPECT_EQ(hex_txt, encodeHex(data));
}
void
compareData(const std::vector<uint8_t>& data)
{
EXPECT_EQ(0xde, data[0]);
EXPECT_EQ(0xad, data[1]);
EXPECT_EQ(0xbe, data[2]);
EXPECT_EQ(0xef, data[3]);
EXPECT_EQ(0xde, data[4]);
EXPECT_EQ(0xca, data[5]);
EXPECT_EQ(0xde, data[6]);
}
TEST_F(HexTest, decodeHex) {
std::vector<uint8_t>result;
result.clear();
std::vector<uint8_t> result;
decodeHex(hex_txt, result);
EXPECT_EQ(0xde, result[0]);
EXPECT_EQ(0xad, result[1]);
EXPECT_EQ(0xbe, result[2]);
EXPECT_EQ(0xef, result[3]);
EXPECT_EQ(0xde, result[4]);
EXPECT_EQ(0xca, result[5]);
EXPECT_EQ(0xde, result[6]);
compareData(result);
}
#if 0
// lower case hex digits should be accepted
result.clear();
decodeHex(hex_txt_lower, result);
compareData(result);
// Bogus input: should fail
result.clear();
decodeHex("1x", result);
#endif
}
}
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