BIND 10 trac1112, updated. 4e12574323ca3db3e985acee0540c603b2b33124 [trac1112] Add more unit tests and comments
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 2 03:48:00 UTC 2011
The branch, trac1112 has been updated
via 4e12574323ca3db3e985acee0540c603b2b33124 (commit)
from 3fc53ba91b92ad40ebbf46272f57a45e3d2e3a27 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4e12574323ca3db3e985acee0540c603b2b33124
Author: Ocean Wang <wanghaidong at cnnic.cn>
Date: Fri Sep 2 11:47:17 2011 +0800
[trac1112] Add more unit tests and comments
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/rdata/generic/hinfo_13.cc | 6 +++---
src/lib/dns/rdata/generic/hinfo_13.h | 6 ++++++
src/lib/dns/tests/rdata_hinfo_unittest.cc | 14 ++++++++++++++
3 files changed, 23 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/hinfo_13.cc b/src/lib/dns/rdata/generic/hinfo_13.cc
index cb22107..d18584e 100644
--- a/src/lib/dns/rdata/generic/hinfo_13.cc
+++ b/src/lib/dns/rdata/generic/hinfo_13.cc
@@ -60,7 +60,7 @@ HINFO::toText() const {
result += "\" \"";
result += os_;
result += "\"";
- return result;
+ return (result);
}
void
@@ -102,12 +102,12 @@ HINFO::compare(const Rdata& other) const {
const std::string&
HINFO::getCPU() const {
- return cpu_;
+ return (cpu_);
}
const std::string&
HINFO::getOS() const {
- return os_;
+ return (os_);
}
void
diff --git a/src/lib/dns/rdata/generic/hinfo_13.h b/src/lib/dns/rdata/generic/hinfo_13.h
index 6b39c9b..78fee67 100644
--- a/src/lib/dns/rdata/generic/hinfo_13.h
+++ b/src/lib/dns/rdata/generic/hinfo_13.h
@@ -28,6 +28,12 @@
// BEGIN_RDATA_NAMESPACE
+/// \brief \c HINFO class represents the HINFO rdata defined in
+/// RFC1034, RFC1035
+///
+/// This class implements the basic interfaces inherited from the
+/// \c rdata::Rdata class, and provides accessors specific to the
+/// HINFO rdata.
class HINFO : public Rdata {
public:
// BEGIN_COMMON_MEMBERS
diff --git a/src/lib/dns/tests/rdata_hinfo_unittest.cc b/src/lib/dns/tests/rdata_hinfo_unittest.cc
index f80952f..c934071 100644
--- a/src/lib/dns/tests/rdata_hinfo_unittest.cc
+++ b/src/lib/dns/tests/rdata_hinfo_unittest.cc
@@ -51,6 +51,20 @@ TEST_F(Rdata_HINFO_Test, createFromText) {
EXPECT_EQ(string("Linux"), hinfo.getOS());
}
+TEST_F(Rdata_HINFO_Test, badText) {
+ // Fields must be seperated by spaces
+ EXPECT_THROW(const HINFO hinfo("\"Pentium\"\"Linux\""), InvalidRdataText);
+ // Field cannot be missing
+ EXPECT_THROW(const HINFO hinfo("Pentium"), InvalidRdataText);
+ // The <character-string> cannot exceed 255 characters
+ string hinfo_str;
+ for (int i = 0; i < 257; ++i) {
+ hinfo_str += 'A';
+ }
+ hinfo_str += " Linux";
+ EXPECT_THROW(const HINFO hinfo(hinfo_str), CharStringTooLong);
+}
+
TEST_F(Rdata_HINFO_Test, createFromWire) {
InputBuffer input_buffer(hinfo_rdata, sizeof(hinfo_rdata));
HINFO hinfo(input_buffer, sizeof(hinfo_rdata));
More information about the bind10-changes
mailing list