brintos

brintos / llvm-project-archived public Read only

0
0
Text · 996 B · 2bbfe4f Raw
28 lines · cpp
1//===-- Unittests for epoll_create ----------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8#include "src/sys/epoll/epoll_create.h"9#include "src/unistd/close.h"10#include "test/UnitTest/ErrnoCheckingTest.h"11#include "test/UnitTest/ErrnoSetterMatcher.h"12#include "test/UnitTest/Test.h"13 14using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;15using LlvmLibcEpollCreateTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;16 17TEST_F(LlvmLibcEpollCreateTest, Basic) {18  int fd = LIBC_NAMESPACE::epoll_create(1);19  ASSERT_GT(fd, 0);20  ASSERT_ERRNO_SUCCESS();21 22  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds());23}24 25TEST_F(LlvmLibcEpollCreateTest, Fails) {26  ASSERT_THAT(LIBC_NAMESPACE::epoll_create(0), Fails(EINVAL));27}28