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 | |
18 | TEST(LlvmLibcSocketTest, LocalSocket) { |
19 | int sock = LIBC_NAMESPACE::socket(AF_UNIX, SOCK_DGRAM, protocol: 0); |
20 | ASSERT_GE(sock, 0); |
21 | ASSERT_ERRNO_SUCCESS(); |
22 | |
23 | LIBC_NAMESPACE::close(fd: sock); |
24 | } |
25 |