aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/counters/meter_ut.cpp
diff options
context:
space:
mode:
authormonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
committermonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /library/cpp/monlib/counters/meter_ut.cpp
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
downloadydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz
fix ya.make
Diffstat (limited to 'library/cpp/monlib/counters/meter_ut.cpp')
-rw-r--r--library/cpp/monlib/counters/meter_ut.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/library/cpp/monlib/counters/meter_ut.cpp b/library/cpp/monlib/counters/meter_ut.cpp
deleted file mode 100644
index b507d16fbdd..00000000000
--- a/library/cpp/monlib/counters/meter_ut.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "meter.h"
-
-#include <library/cpp/testing/unittest/registar.h>
-
-using namespace NMonitoring;
-
-struct TMockClock {
- using duration = std::chrono::nanoseconds;
- using rep = duration::rep;
- using period = duration::period;
- using time_point = std::chrono::time_point<TMockClock, duration>;
-
- static time_point now() noexcept {
- static int index = 0;
- return index++ < 2 ? time_point() : time_point(std::chrono::seconds(10));
- }
-};
-
-using TMockMeter = TMeterImpl<TMockClock>;
-
-Y_UNIT_TEST_SUITE(TMeterTest) {
- Y_UNIT_TEST(StartsOutWithNoRatesOrCount) {
- TMeter meter;
- UNIT_ASSERT_EQUAL(meter.GetCount(), 0L);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetMeanRate(), 0.0, 0.0001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetOneMinuteRate(), 0.0, 0.0001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetFiveMinutesRate(), 0.0, 0.0001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetFifteenMinutesRate(), 0.0, 0.0001);
- }
-
- Y_UNIT_TEST(MarksEventsAndUpdatesRatesAndCount) {
- TMockMeter meter;
- meter.Mark();
- meter.Mark(2);
- UNIT_ASSERT_EQUAL(meter.GetCount(), 3L);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetMeanRate(), 0.3, 0.001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetOneMinuteRate(), 0.1840, 0.0001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetFiveMinutesRate(), 0.1966, 0.0001);
- UNIT_ASSERT_DOUBLES_EQUAL(meter.GetFifteenMinutesRate(), 0.1988, 0.0001);
- }
-}