Merge "Add a test that getaddrinfo works when hints are NULL."

This commit is contained in:
Elliott Hughes 2013-02-13 17:04:01 +00:00 committed by Gerrit Code Review
commit f659b3c90d
2 changed files with 29 additions and 0 deletions

View File

@ -63,6 +63,7 @@ test_src_files = \
getcwd_test.cpp \ getcwd_test.cpp \
libgen_test.cpp \ libgen_test.cpp \
math_test.cpp \ math_test.cpp \
netdb_test.cpp \
pthread_test.cpp \ pthread_test.cpp \
regex_test.cpp \ regex_test.cpp \
signal_test.cpp \ signal_test.cpp \

28
tests/netdb_test.cpp Normal file
View File

@ -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);
}