Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / test / src / time / time_test.cpp
blob1d938e8dae7adb237e578434ea7422fb7226f448
1 //===-- Unittests for time ------------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "src/time/time_func.h"
10 #include "test/UnitTest/Test.h"
12 #include <limits.h>
13 #include <time.h>
15 TEST(LlvmLibcTimeTest, SmokeTest) {
16 time_t t1;
17 time_t t2 = LIBC_NAMESPACE::time(&t1);
18 ASSERT_EQ(t1, t2);
19 ASSERT_GT(t1, time_t(0));
21 time_t t3 = LIBC_NAMESPACE::time(nullptr);
22 ASSERT_GE(t3, t1);