1 | //===-- Unittests for poll ------------------------------------------------===// |
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 "hdr/limits_macros.h" // UINT_MAX |
10 | #include "src/__support/libc_errno.h" |
11 | #include "src/poll/poll.h" |
12 | #include "test/UnitTest/Test.h" |
13 | |
14 | TEST(LlvmLibcPollTest, SmokeTest) { |
15 | libc_errno = 0; |
16 | int ret = LIBC_NAMESPACE::poll(nullptr, 0, 0); |
17 | ASSERT_ERRNO_SUCCESS(); |
18 | ASSERT_EQ(0, ret); |
19 | } |
20 | TEST(LlvmLibcPollTest, SmokeFailureTest) { |
21 | libc_errno = 0; |
22 | int ret = LIBC_NAMESPACE::poll(nullptr, UINT_MAX, 0); |
23 | ASSERT_ERRNO_EQ(EINVAL); |
24 | ASSERT_EQ(-1, ret); |
25 | } |
26 | |