added test

This commit is contained in:
Erik Frojdh
2019-04-03 19:59:37 +02:00
parent 69a11f8950
commit 7256a1e422
3 changed files with 66 additions and 18 deletions

View File

@ -16,10 +16,19 @@ class IpAddr {
IpAddr(const char *address);
std::string str() const;
std::string hex() const;
constexpr bool operator==(const IpAddr &other) const noexcept { return addr_ == other.addr_; }
constexpr bool operator!=(const IpAddr &other) const noexcept { return addr_ != other.addr_; }
constexpr bool operator==(const uint32_t other) const noexcept { return addr_ == other; }
constexpr bool operator!=(const uint32_t other) const noexcept { return addr_ != other; }
constexpr bool operator==(const IpAddr &other) const noexcept {
return addr_ == other.addr_;
}
constexpr bool operator!=(const IpAddr &other) const noexcept {
return addr_ != other.addr_;
}
constexpr bool operator==(const uint32_t other) const noexcept {
return addr_ == other;
}
constexpr bool operator!=(const uint32_t other) const noexcept {
return addr_ != other;
}
constexpr uint32_t uint32() const noexcept { return addr_; }
};
class MacAddr {
@ -33,10 +42,19 @@ class MacAddr {
MacAddr(const char *address);
std::string str() const;
std::string hex() const;
constexpr bool operator==(const MacAddr &other) const noexcept { return addr_ == other.addr_; }
constexpr bool operator!=(const MacAddr &other) const noexcept { return addr_ != other.addr_; }
constexpr bool operator==(const uint64_t other) const noexcept { return addr_ == other; }
constexpr bool operator!=(const uint64_t other) const noexcept { return addr_ != other; }
constexpr bool operator==(const MacAddr &other) const noexcept {
return addr_ == other.addr_;
}
constexpr bool operator!=(const MacAddr &other) const noexcept {
return addr_ != other.addr_;
}
constexpr bool operator==(const uint64_t other) const noexcept {
return addr_ == other;
}
constexpr bool operator!=(const uint64_t other) const noexcept {
return addr_ != other;
}
constexpr uint64_t uint64() const noexcept { return addr_; }
};
std::ostream &operator<<(std::ostream &out, const IpAddr &addr);