Commit 4d4f66ce authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[master] Fixed libdhcpsrv unit tests that failed to compile under GTEST 1.5

Added output redirect operator "<<" to Lease class so new unit tests in
libdhcpsrv will compile under gtest 1.5.
Also fixed incorrect index into lease collection for same tests.
parent b3f795e7
...@@ -266,5 +266,11 @@ Lease6::operator==(const Lease6& other) const { ...@@ -266,5 +266,11 @@ Lease6::operator==(const Lease6& other) const {
comments_ == other.comments_); comments_ == other.comments_);
} }
std::ostream&
operator<<(std::ostream& os, const Lease& lease) {
os << lease.toText();
return (os);
}
} // namespace isc::dhcp } // namespace isc::dhcp
} // namespace isc } // namespace isc
...@@ -401,6 +401,15 @@ typedef boost::shared_ptr<const Lease6> ConstLease6Ptr; ...@@ -401,6 +401,15 @@ typedef boost::shared_ptr<const Lease6> ConstLease6Ptr;
/// @brief A collection of IPv6 leases. /// @brief A collection of IPv6 leases.
typedef std::vector<Lease6Ptr> Lease6Collection; typedef std::vector<Lease6Ptr> Lease6Collection;
/// @brief Stream output operator.
///
/// Dumps the output of Lease::toText to the given stream.
/// @param os output stream to which the output is
/// @param lease reference to Lease object to dump
/// @return a reference to the output stream paramater
std::ostream&
operator<<(std::ostream& os, const Lease& lease);
}; // end of isc::dhcp namespace }; // end of isc::dhcp namespace
}; // end of isc namespace }; // end of isc namespace
......
...@@ -1452,7 +1452,7 @@ GenericLeaseMgrTest::testRecreateLease4() { ...@@ -1452,7 +1452,7 @@ GenericLeaseMgrTest::testRecreateLease4() {
++lease->valid_lft_; ++lease->valid_lft_;
lease->fqdn_fwd_ = !lease->fqdn_fwd_; lease->fqdn_fwd_ = !lease->fqdn_fwd_;
// Make sure that the lease has been really modified. // Make sure that the lease has been really modified.
ASSERT_NE(*lease, *leases[1]); ASSERT_NE(*lease, *leases[0]);
// Add the updated lease. // Add the updated lease.
EXPECT_TRUE(lmptr_->addLease(lease)); EXPECT_TRUE(lmptr_->addLease(lease));
lmptr_->commit(); lmptr_->commit();
...@@ -1492,7 +1492,7 @@ GenericLeaseMgrTest::testRecreateLease6() { ...@@ -1492,7 +1492,7 @@ GenericLeaseMgrTest::testRecreateLease6() {
++lease->valid_lft_; ++lease->valid_lft_;
lease->fqdn_fwd_ = !lease->fqdn_fwd_; lease->fqdn_fwd_ = !lease->fqdn_fwd_;
// Make sure that the lease has been really modified. // Make sure that the lease has been really modified.
ASSERT_NE(*lease, *leases[1]); ASSERT_NE(*lease, *leases[0]);
// Add the updated lease. // Add the updated lease.
EXPECT_TRUE(lmptr_->addLease(lease)); EXPECT_TRUE(lmptr_->addLease(lease));
lmptr_->commit(); lmptr_->commit();
......
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