chromium/third_party/abseil-cpp/absl/time/time_test.cc

// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "absl/time/time.h"
#include "absl/time/civil_time.h"

#if defined(_MSC_VER)
#include <winsock2.h>  // for timeval
#endif

#include "absl/base/config.h"

// For feature testing and determining which headers can be included.
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
#include <version>
#endif

#include <chrono>  // NOLINT(build/c++11)
#ifdef __cpp_lib_three_way_comparison
#include <compare>
#endif  // __cpp_lib_three_way_comparison
#include <cstdint>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <ios>
#include <limits>
#include <string>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/numeric/int128.h"
#include "absl/strings/str_format.h"
#include "absl/time/clock.h"
#include "absl/time/internal/test_util.h"

namespace {

#if defined(GTEST_USES_SIMPLE_RE) && GTEST_USES_SIMPLE_RE
const char kZoneAbbrRE[] = ".*";  // just punt
#else
const char kZoneAbbrRE[] =;
#endif

// This helper is a macro so that failed expectations show up with the
// correct line numbers.
#define EXPECT_CIVIL_INFO(ci, y, m, d, h, min, s, off, isdst)

// A gMock matcher to match timespec values. Use this matcher like:
// timespec ts1, ts2;
// EXPECT_THAT(ts1, TimespecMatcher(ts2));
MATCHER_P(TimespecMatcher, ts, "") {}

// A gMock matcher to match timeval values. Use this matcher like:
// timeval tv1, tv2;
// EXPECT_THAT(tv1, TimevalMatcher(tv2));
MATCHER_P(TimevalMatcher, tv, "") {}

TEST(Time, ConstExpr) {}

TEST(Time, ValueSemantics) {}

TEST(Time, UnixEpoch) {}

TEST(Time, Breakdown) {}

TEST(Time, AdditiveOperators) {}

TEST(Time, RelationalOperators) {}

TEST(Time, Infinity) {}

TEST(Time, FloorConversion) {}

TEST(Time, RoundtripConversion) {}

template <typename Duration>
std::chrono::system_clock::time_point MakeChronoUnixTime(const Duration& d) {}

TEST(Time, FromChrono) {}

TEST(Time, ToChronoTime) {}

// Check that absl::int128 works as a std::chrono::duration representation.
TEST(Time, Chrono128) {}

TEST(Time, TimeZoneAt) {}

// FromCivil(CivilSecond(year, mon, day, hour, min, sec), UTCTimeZone())
// has a specialized fastpath implementation, which we exercise here.
TEST(Time, FromCivilUTC) {}

TEST(Time, ToTM) {}

TEST(Time, FromTM) {}

TEST(Time, TMRoundTrip) {}

TEST(Time, Range) {}

TEST(Time, Limits) {}

TEST(Time, ConversionSaturation) {}

// In zones with POSIX-style recurring rules we use special logic to
// handle conversions in the distant future.  Here we check the limits
// of those conversions, particularly with respect to integer overflow.
TEST(Time, ExtendedConversionSaturation) {}

TEST(Time, FromCivilAlignment) {}

TEST(Time, LegacyDateTime) {}

TEST(Time, NextTransitionUTC) {}

TEST(Time, PrevTransitionUTC) {}

TEST(Time, NextTransitionNYC) {}

TEST(Time, PrevTransitionNYC) {}

TEST(Time, AbslStringify) {}

}  // namespace