xref: /llvm-project/libc/test/src/sys/socket/linux/socket_test.cpp (revision 73874f7a39df74eacf1682b3961da2d8cb675f33)
1ee17fd7dSMichael Jones //===-- Unittests for socket ----------------------------------------------===//
2ee17fd7dSMichael Jones //
3ee17fd7dSMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4ee17fd7dSMichael Jones // See https://llvm.org/LICENSE.txt for license information.
5ee17fd7dSMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6ee17fd7dSMichael Jones //
7ee17fd7dSMichael Jones //===----------------------------------------------------------------------===//
8ee17fd7dSMichael Jones 
9ee17fd7dSMichael Jones #include "src/sys/socket/socket.h"
10ee17fd7dSMichael Jones 
11ee17fd7dSMichael Jones #include "src/unistd/close.h"
12ee17fd7dSMichael Jones 
13ee17fd7dSMichael Jones #include "src/errno/libc_errno.h"
14ee17fd7dSMichael Jones #include "test/UnitTest/Test.h"
15ee17fd7dSMichael Jones 
168180ea86Smichaelrj-google #include <sys/socket.h> // For AF_UNIX and SOCK_DGRAM
17ee17fd7dSMichael Jones 
TEST(LlvmLibcSocketTest,LocalSocket)18ee17fd7dSMichael Jones TEST(LlvmLibcSocketTest, LocalSocket) {
198180ea86Smichaelrj-google   int sock = LIBC_NAMESPACE::socket(AF_UNIX, SOCK_DGRAM, 0);
20ee17fd7dSMichael Jones   ASSERT_GE(sock, 0);
21*73874f7aSGuillaume Chatelet   ASSERT_ERRNO_SUCCESS();
22ee17fd7dSMichael Jones 
23b6bc9d72SGuillaume Chatelet   LIBC_NAMESPACE::close(sock);
24ee17fd7dSMichael Jones }
25