aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/llhost_tut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/test/llhost_tut.cpp')
-rw-r--r--linden/indra/test/llhost_tut.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/linden/indra/test/llhost_tut.cpp b/linden/indra/test/llhost_tut.cpp
index fc2aee3..f1ad4e0 100644
--- a/linden/indra/test/llhost_tut.cpp
+++ b/linden/indra/test/llhost_tut.cpp
@@ -91,7 +91,7 @@ namespace tut
91 U32 ip = ip_string_to_u32("192.168.1.1"); 91 U32 ip = ip_string_to_u32("192.168.1.1");
92 U32 port = 8080; 92 U32 port = 8080;
93 93
94 LLHost host(ip_port_string.c_str()); 94 LLHost host(ip_port_string);
95 ensure("IP address from IP:port is invalid", ip == host.getAddress()); 95 ensure("IP address from IP:port is invalid", ip == host.getAddress());
96 ensure("Port Number from from IP:port is invalid", port == host.getPort()); 96 ensure("Port Number from from IP:port is invalid", port == host.getPort());
97 } 97 }
@@ -138,23 +138,16 @@ namespace tut
138 template<> template<> 138 template<> template<>
139 void host_object::test<8>() 139 void host_object::test<8>()
140 { 140 {
141 char buffer[50]; 141 const std::string str("192.168.1.1");
142 char buffer1[50];
143 const char* str = "192.168.1.1";
144 U32 port = 8080; 142 U32 port = 8080;
145 LLHost host; 143 LLHost host;
146 host.set(str,port); 144 host.set(str,port);
147 host.getString(buffer, 50);
148 ensure("Function Failed", (0 == strcmp("192.168.1.1:8080", buffer)));
149
150 host.getIPString(buffer1, 50);
151 ensure("Function Failed", (0 == strcmp(str, buffer1)));
152 145
153 std::string ip_string = host.getIPString(); 146 std::string ip_string = host.getIPString();
154 ensure("Function Failed", (0 == strcmp(str, buffer1))); 147 ensure("Function Failed", (ip_string == str));
155 148
156 std::string ip_string_port = host.getIPandPort(); 149 std::string ip_string_port = host.getIPandPort();
157 ensure("Function Failed", (0 == strcmp("192.168.1.1:8080", buffer))); 150 ensure("Function Failed", (ip_string_port == "192.168.1.1:8080"));
158 } 151 }
159 152
160 153
@@ -163,17 +156,15 @@ namespace tut
163 void host_object::test<9>() 156 void host_object::test<9>()
164 { 157 {
165 std::string hostStr = "google.com"; 158 std::string hostStr = "google.com";
166 char buffer[50] = {0};
167 LLHost host; 159 LLHost host;
168 host.setHostByName(hostStr.c_str()); 160 host.setHostByName(hostStr);
169 host.getHostName(buffer, 50); 161
170 // reverse DNS will likely result in appending of some 162 // reverse DNS will likely result in appending of some
171 // sub-domain to the main hostname. so look for 163 // sub-domain to the main hostname. so look for
172 // the main domain name and not do the exact compare 164 // the main domain name and not do the exact compare
173 ensure("getHostName failed", (NULL != strstr(buffer, hostStr.c_str())));
174 165
175 LLString hostname = host.getHostName(); 166 std::string hostname = host.getHostName();
176 ensure("getHostName failed", (NULL != strstr(hostname.c_str(), hostStr.c_str()))); 167 ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
177 } 168 }
178 169
179// setHostByName for dotted IP 170// setHostByName for dotted IP
@@ -182,7 +173,7 @@ namespace tut
182 { 173 {
183 std::string hostStr = "64.233.167.99"; 174 std::string hostStr = "64.233.167.99";
184 LLHost host; 175 LLHost host;
185 host.setHostByName(hostStr.c_str()); 176 host.setHostByName(hostStr);
186 ensure("SetHostByName for dotted IP Address failed", host.getAddress() == ip_string_to_u32(hostStr.c_str())); 177 ensure("SetHostByName for dotted IP Address failed", host.getAddress() == ip_string_to_u32(hostStr.c_str()));
187 } 178 }
188 179