summaryrefslogtreecommitdiff
path: root/tests/netdb_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-13 17:04:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-02-13 17:04:01 +0000
commitf659b3c90d8b55a44945af807364a5df0475bd0e (patch)
treedba3210fb3177ad600b337f6adfa3cad661cad6b /tests/netdb_test.cpp
parent3002d64bcd4644456803dd0547d20b39e14be02c (diff)
parentd3b9d11369ee15dc0ce512014284c3c5432f2813 (diff)
Merge "Add a test that getaddrinfo works when hints are NULL."
Diffstat (limited to 'tests/netdb_test.cpp')
-rw-r--r--tests/netdb_test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/netdb_test.cpp b/tests/netdb_test.cpp
new file mode 100644
index 000000000..168f7c148
--- /dev/null
+++ b/tests/netdb_test.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+
+TEST(netdb, getaddrinfo_NULL_hints) {
+ addrinfo* ai = NULL;
+ ASSERT_EQ(0, getaddrinfo("localhost", "9999", NULL, &ai));
+ freeaddrinfo(ai);
+}