diff options
Diffstat (limited to 'library/cpp/yt/cpu_clock/unittests/clock_ut.cpp')
-rw-r--r-- | library/cpp/yt/cpu_clock/unittests/clock_ut.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/library/cpp/yt/cpu_clock/unittests/clock_ut.cpp b/library/cpp/yt/cpu_clock/unittests/clock_ut.cpp deleted file mode 100644 index bd9cb6d4be..0000000000 --- a/library/cpp/yt/cpu_clock/unittests/clock_ut.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <gtest/gtest.h> - -#include <library/cpp/yt/cpu_clock/clock.h> - -namespace NYT { -namespace { - -//////////////////////////////////////////////////////////////////////////////// - -template <class T> -i64 DiffMS(T a, T b) -{ - return a >= b - ? static_cast<i64>(a.MilliSeconds()) - static_cast<i64>(b.MilliSeconds()) - : DiffMS(b, a); -} - -TEST(TTimingTest, GetInstant) -{ - GetInstant(); - - EXPECT_LE(DiffMS(GetInstant(), TInstant::Now()), 10); -} - -TEST(TTimingTest, InstantVSCpuInstant) -{ - auto instant1 = TInstant::Now(); - auto cpuInstant = InstantToCpuInstant(instant1); - auto instant2 = CpuInstantToInstant(cpuInstant); - EXPECT_LE(DiffMS(instant1, instant2), 10); -} - -TEST(TTimingTest, DurationVSCpuDuration) -{ - auto cpuInstant1 = GetCpuInstant(); - constexpr auto duration1 = TDuration::MilliSeconds(100); - Sleep(duration1); - auto cpuInstant2 = GetCpuInstant(); - auto duration2 = CpuDurationToDuration(cpuInstant2 - cpuInstant1); - EXPECT_LE(DiffMS(duration1, duration2), 10); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace -} // namespace NYT |