summaryrefslogtreecommitdiff
path: root/tests/netdb_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-10-22 21:30:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-10-22 21:30:40 +0000
commitcf8ea37fc91e23d37b3c5873b5e152ccae293f03 (patch)
treebb1d006f296be71fec6ed5c05a231e437d96780a /tests/netdb_test.cpp
parente516321d78162479a4ce17bd5a9ba8c0834abf18 (diff)
parent4912fc7d152236cb496aec01eb5800cfd1b757c7 (diff)
Merge "bionic/tests: migrate gethostbyname bionic test from system/extra to bionic/tests"
Diffstat (limited to 'tests/netdb_test.cpp')
-rw-r--r--tests/netdb_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/netdb_test.cpp b/tests/netdb_test.cpp
index 33f6c01d8..cc08715f2 100644
--- a/tests/netdb_test.cpp
+++ b/tests/netdb_test.cpp
@@ -55,3 +55,13 @@ TEST(netdb, getnameinfo_salen) {
ASSERT_STREQ("::", tmp);
ASSERT_EQ(EAI_FAMILY, getnameinfo(sa, too_little, tmp, sizeof(tmp), NULL, 0, NI_NUMERICHOST));
}
+
+TEST(netdb, gethostbyname) {
+ hostent* hent = gethostbyname("localhost");
+ ASSERT_TRUE(hent != NULL);
+ ASSERT_EQ(hent->h_addrtype, AF_INET);
+ ASSERT_EQ(hent->h_addr[0], 127);
+ ASSERT_EQ(hent->h_addr[1], 0);
+ ASSERT_EQ(hent->h_addr[2], 0);
+ ASSERT_EQ(hent->h_addr[3], 1);
+}