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