xref: /llvm-project/libc/test/src/time/time_test.cpp (revision e6cf5d2863b77895ae7183952514bedd9e8dde16)
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 TEST(LlvmLibcTimeTest, SmokeTest) {
13   time_t t1;
14   time_t t2 = LIBC_NAMESPACE::time(&t1);
15   ASSERT_EQ(t1, t2);
16   ASSERT_GT(t1, time_t(0));
17 
18   time_t t3 = LIBC_NAMESPACE::time(nullptr);
19   ASSERT_GE(t3, t1);
20 }
21