summaryrefslogtreecommitdiff
path: root/libc/test/src/time/time_test.cpp
blob: 92fd8e48a77a399af2cd5df1ae9d29f41d79b0b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//===-- Unittests for time ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/time/time_func.h"
#include "test/UnitTest/Test.h"

#include <limits.h>
#include <time.h>

TEST(LlvmLibcTimeTest, SmokeTest) {
  time_t t1;
  time_t t2 = __llvm_libc::time(&t1);
  ASSERT_EQ(t1, t2);
  ASSERT_GT(t1, time_t(0));

  time_t t3 = __llvm_libc::time(nullptr);
  ASSERT_GE(t3, t1);
}