1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-25 11:41:35 +01:00

Removed Utils::ip_to_int/string. Everything is using IPv4Address now.

This commit is contained in:
Matias Fontanini
2012-08-27 23:54:43 -03:00
parent e1a84be0cb
commit fbd6ef397b
7 changed files with 35 additions and 87 deletions

View File

@@ -57,30 +57,6 @@ const uint8_t UtilsTest::data[] = {
};
const uint32_t UtilsTest::data_len = 500;
TEST_F(UtilsTest, IpToInt) {
EXPECT_EQ(Utils::ip_to_int("0.0.0.0"), zero_int_ip);
EXPECT_EQ(Utils::ip_to_int("255.255.255.255"), full_int_ip);
EXPECT_EQ(Utils::ip_to_int("1.2.255.3"), mix_int_ip);
/* Invalid number */
EXPECT_THROW(Utils::ip_to_int("123.a.5.6"), std::runtime_error);
EXPECT_THROW(Utils::ip_to_int("0.0.256.0"), std::runtime_error);
EXPECT_THROW(Utils::ip_to_int("0.0.255.0a"), std::runtime_error);
EXPECT_THROW(Utils::ip_to_int("0.0.255.127a"), std::runtime_error);
EXPECT_THROW(Utils::ip_to_int("0.0.255.1.5"), std::runtime_error);
}
TEST_F(UtilsTest, IpToString) {
EXPECT_EQ(Utils::ip_to_string(zero_int_ip), "0.0.0.0");
EXPECT_EQ(Utils::ip_to_string(full_int_ip), "255.255.255.255");
EXPECT_EQ(Utils::ip_to_string(mix_int_ip), "1.2.255.3");
}
TEST_F(UtilsTest, ResolveIp) {
IPv4Address localhost_ip("127.0.0.1");
@@ -89,7 +65,6 @@ TEST_F(UtilsTest, ResolveIp) {
}
TEST_F(UtilsTest, NetToHostS) {
uint16_t a = 0x01FE;
uint16_t b = Utils::net_to_host_s(a);