1 //===-- Unittests for nanosleep -------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 #include "src/errno/libc_errno.h"
12 #include "src/time/nanosleep.h"
13 #include "test/UnitTest/ErrnoSetterMatcher.h"
14 #include "test/UnitTest/Test.h"
16 namespace cpp
= LIBC_NAMESPACE::cpp
;
18 TEST(LlvmLibcNanosleep
, SmokeTest
) {
19 // TODO: When we have the code to read clocks, test that time has passed.
20 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds
;
23 struct timespec tim
= {1, 500};
24 struct timespec tim2
= {0, 0};
25 int ret
= LIBC_NAMESPACE::nanosleep(&tim
, &tim2
);
26 ASSERT_EQ(libc_errno
, 0);