24 lines · cpp
1//===-- Unittests for nanosleep -------------------------------------------===//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 9#include "hdr/types/struct_timespec.h"10#include "src/time/nanosleep.h"11#include "test/UnitTest/ErrnoCheckingTest.h"12#include "test/UnitTest/Test.h"13 14namespace cpp = LIBC_NAMESPACE::cpp;15 16using LlvmLibcNanosleep = LIBC_NAMESPACE::testing::ErrnoCheckingTest;17 18TEST_F(LlvmLibcNanosleep, SmokeTest) {19 // TODO: When we have the code to read clocks, test that time has passed.20 struct timespec tim = {1, 500};21 struct timespec tim2 = {0, 0};22 ASSERT_EQ(LIBC_NAMESPACE::nanosleep(&tim, &tim2), 0);23}24