xref: /aosp_15_r20/external/llvm-libc/test/src/time/time_test.cpp (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
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 //===----------------------------------------------------------------------===//
8 
9 #include "src/time/time_func.h"
10 #include "test/UnitTest/Test.h"
11 
12 #include <time.h>
13 
TEST(LlvmLibcTimeTest,SmokeTest)14 TEST(LlvmLibcTimeTest, SmokeTest) {
15   time_t t1;
16   time_t t2 = LIBC_NAMESPACE::time(&t1);
17   ASSERT_EQ(t1, t2);
18   ASSERT_GT(t1, time_t(0));
19 
20   time_t t3 = LIBC_NAMESPACE::time(nullptr);
21   ASSERT_GE(t3, t1);
22 }
23