test/core/gprpp/time_test.cc
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 #include <limits>
18 
19 #include <gtest/gtest.h>
20 
21 namespace grpc_core {
22 namespace testing {
23 
24 TEST(TimestampTest, Empty) {
26 }
27 
28 TEST(TimestampTest, Infinities) {
33 }
34 
35 TEST(TimestampTest, ToString) {
37  "@42ms");
40 }
41 
42 TEST(DurationTest, Empty) { EXPECT_EQ(Duration(), Duration::Zero()); }
43 
44 TEST(DurationTest, Scales) {
51 }
52 
53 TEST(DurationTest, Epsilon) {
55 }
56 
57 TEST(DurationTest, Infinities) {
76 }
77 
78 TEST(DurationTest, FromTimespan) {
81 }
82 
83 TEST(DurationTest, ToString) {
87 }
88 
89 } // namespace testing
90 } // namespace grpc_core
91 
92 int main(int argc, char** argv) {
93  ::testing::InitGoogleTest(&argc, argv);
94  return RUN_ALL_TESTS();
95 }
GPR_TIMESPAN
@ GPR_TIMESPAN
Definition: gpr_types.h:45
grpc_core::Duration::Hours
static constexpr Duration Hours(int64_t hours)
Definition: src/core/lib/gprpp/time.h:143
testing
Definition: aws_request_signer_test.cc:25
grpc_core::Duration::FromSecondsAsDouble
static Duration FromSecondsAsDouble(double seconds)
Definition: src/core/lib/gprpp/time.h:279
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::Timestamp::InfPast
static constexpr Timestamp InfPast()
Definition: src/core/lib/gprpp/time.h:83
EXPECT_LE
#define EXPECT_LE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2030
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
ToString
std::string ToString(const grpc::string_ref &r)
Definition: string_ref_helper.cc:24
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
Timestamp
struct Timestamp Timestamp
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:672
grpc_core::Duration::FromSecondsAndNanoseconds
static Duration FromSecondsAndNanoseconds(int64_t seconds, int32_t nanos)
Definition: src/core/lib/gprpp/time.h:274
time.h
grpc_core::Duration::FromTimespec
static Duration FromTimespec(gpr_timespec t)
Definition: src/core/lib/gprpp/time.cc:175
grpc_core::Duration::Epsilon
static constexpr Duration Epsilon()
Definition: src/core/lib/gprpp/time.h:133
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
grpc_core::Timestamp::ProcessEpoch
static constexpr Timestamp ProcessEpoch()
Definition: src/core/lib/gprpp/time.h:77
grpc_core::Duration::NegativeInfinity
static constexpr Duration NegativeInfinity()
Definition: src/core/lib/gprpp/time.h:135
Empty
Definition: abseil-cpp/absl/container/internal/compressed_tuple_test.cc:33
grpc_core::Timestamp::FromMillisecondsAfterProcessEpoch
static constexpr Timestamp FromMillisecondsAfterProcessEpoch(int64_t millis)
Definition: src/core/lib/gprpp/time.h:73
grpc_core::Duration::Zero
static constexpr Duration Zero()
Definition: src/core/lib/gprpp/time.h:130
grpc_core::Duration::Milliseconds
static constexpr Duration Milliseconds(int64_t millis)
Definition: src/core/lib/gprpp/time.h:155
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
grpc_core::Duration::Seconds
static constexpr Duration Seconds(int64_t seconds)
Definition: src/core/lib/gprpp/time.h:151
gpr_time_from_millis
GPRAPI gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type clock_type)
Definition: src/core/lib/gpr/time.cc:119
grpc_core::testing::TEST
TEST(ServiceConfigParserTest, DoubleRegistration)
Definition: service_config_test.cc:448
grpc_core::Timestamp::InfFuture
static constexpr Timestamp InfFuture()
Definition: src/core/lib/gprpp/time.h:79
Duration
struct Duration Duration
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:640
main
int main(int argc, char **argv)
Definition: test/core/gprpp/time_test.cc:92
grpc_core::Duration::Infinity
static constexpr Duration Infinity()
Definition: src/core/lib/gprpp/time.h:139
grpc_core::Duration::Minutes
static constexpr Duration Minutes(int64_t minutes)
Definition: src/core/lib/gprpp/time.h:147


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:36