summaryrefslogtreecommitdiff
path: root/libc/test/src/poll/poll_test.cpp
blob: 97b7b027181720f0244084a319cdbf9ff12b921b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//===-- Unittests for poll ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "hdr/limits_macros.h" // UINT_MAX
#include "src/__support/libc_errno.h"
#include "src/poll/poll.h"
#include "test/UnitTest/Test.h"

TEST(LlvmLibcPollTest, SmokeTest) {
  libc_errno = 0;
  int ret = LIBC_NAMESPACE::poll(nullptr, 0, 0);
  ASSERT_ERRNO_SUCCESS();
  ASSERT_EQ(0, ret);
}
TEST(LlvmLibcPollTest, SmokeFailureTest) {
  libc_errno = 0;
  int ret = LIBC_NAMESPACE::poll(nullptr, UINT_MAX, 0);
  ASSERT_ERRNO_EQ(EINVAL);
  ASSERT_EQ(-1, ret);
}