void host_object::test<7>() { const char* str = "192.168.1.1"; U32 port = 8080, ip; LLHost host; host.set(str,port); ip = ip_string_to_u32(str); ensure("IP address is invalid", (ip == host.getAddress())); ensure("Port Number is invalid", (port == host.getPort())); str = "64.233.187.99"; ip = ip_string_to_u32(str); host.setAddress(str); ensure("IP address is invalid", (ip == host.getAddress())); ip = 0xc098017b; host.setAddress(ip); ensure("IP address is invalid", (ip == host.getAddress())); // should still use the old port ensure("Port Number is invalid", (port == host.getPort())); port = 8084; host.setPort(port); ensure("Port Number is invalid", (port == host.getPort())); // should still use the old address ensure("IP address is invalid", (ip == host.getAddress())); }
void host_object::test<6>() { U32 ip = 0xc098017d, port = 8080; LLHost host; host.set(ip,port); ensure("IP address is invalid", (ip == host.getAddress())); ensure("Port Number is invalid", (port == host.getPort())); }
void host_object::test<8>() { const std::string str("192.168.1.1"); U32 port = 8080; LLHost host; host.set(str,port); std::string ip_string = host.getIPString(); ensure("Function Failed", (ip_string == str)); std::string ip_string_port = host.getIPandPort(); ensure("Function Failed", (ip_string_port == "192.168.1.1:8080")); }