diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-05 12:48:15 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-05 12:48:15 +0000 |
commit | 9caad60522047a21974b759380f485f85602cf74 (patch) | |
tree | 000ba8400632c5d7a701163194d4fa68c1e8f95a /vespalib | |
parent | a65780d57302eaf5a5791068e233f781e35d4401 (diff) |
Guard against timeout value that is too high and will cause overflow.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/time/time_test.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vespalib/src/tests/time/time_test.cpp b/vespalib/src/tests/time/time_test.cpp index c1e73728485..ddbe68c4f68 100644 --- a/vespalib/src/tests/time/time_test.cpp +++ b/vespalib/src/tests/time/time_test.cpp @@ -59,4 +59,9 @@ TEST(TimeTest, to_string_print_iso_time) { EXPECT_EQ("2019-12-20 02:47:35.768 UTC", to_string(system_time(1576810055768543us))); } +TEST(TimeTest, conversion_of_max) { + EXPECT_EQ(-9223372036.8547764, vespalib::to_s(vespalib::duration::min())); + EXPECT_EQ(9223372036.8547764, vespalib::to_s(vespalib::duration::max())); +} + GTEST_MAIN_RUN_ALL_TESTS() |