summaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/duration_histogram_ut.cpp
diff options
context:
space:
mode:
authornga <[email protected]>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:09 +0300
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/messagebus/duration_histogram_ut.cpp
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/duration_histogram_ut.cpp')
-rw-r--r--library/cpp/messagebus/duration_histogram_ut.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/messagebus/duration_histogram_ut.cpp b/library/cpp/messagebus/duration_histogram_ut.cpp
index 01bcc095e99..5e2a194b6dd 100644
--- a/library/cpp/messagebus/duration_histogram_ut.cpp
+++ b/library/cpp/messagebus/duration_histogram_ut.cpp
@@ -1,38 +1,38 @@
#include <library/cpp/testing/unittest/registar.h>
-
-#include "duration_histogram.h"
-
+
+#include "duration_histogram.h"
+
Y_UNIT_TEST_SUITE(TDurationHistogramTest) {
Y_UNIT_TEST(BucketFor) {
UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(0)));
UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(1)));
UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(900)));
- UNIT_ASSERT_VALUES_EQUAL(1u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(1500)));
- UNIT_ASSERT_VALUES_EQUAL(2u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(2500)));
-
- unsigned sb = TDurationHistogram::SecondBoundary;
-
+ UNIT_ASSERT_VALUES_EQUAL(1u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(1500)));
+ UNIT_ASSERT_VALUES_EQUAL(2u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(2500)));
+
+ unsigned sb = TDurationHistogram::SecondBoundary;
+
UNIT_ASSERT_VALUES_EQUAL(sb - 1, TDurationHistogram::BucketFor(TDuration::MilliSeconds(999)));
- UNIT_ASSERT_VALUES_EQUAL(sb, TDurationHistogram::BucketFor(TDuration::MilliSeconds(1000)));
- UNIT_ASSERT_VALUES_EQUAL(sb, TDurationHistogram::BucketFor(TDuration::MilliSeconds(1001)));
-
- UNIT_ASSERT_VALUES_EQUAL(TDurationHistogram::Buckets - 1, TDurationHistogram::BucketFor(TDuration::Hours(1)));
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(sb, TDurationHistogram::BucketFor(TDuration::MilliSeconds(1000)));
+ UNIT_ASSERT_VALUES_EQUAL(sb, TDurationHistogram::BucketFor(TDuration::MilliSeconds(1001)));
+
+ UNIT_ASSERT_VALUES_EQUAL(TDurationHistogram::Buckets - 1, TDurationHistogram::BucketFor(TDuration::Hours(1)));
+ }
+
Y_UNIT_TEST(Simple) {
- TDurationHistogram h1;
- h1.AddTime(TDuration::MicroSeconds(1));
- UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.front());
-
- TDurationHistogram h2;
- h1.AddTime(TDuration::Hours(1));
- UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.back());
- }
-
+ TDurationHistogram h1;
+ h1.AddTime(TDuration::MicroSeconds(1));
+ UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.front());
+
+ TDurationHistogram h2;
+ h1.AddTime(TDuration::Hours(1));
+ UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.back());
+ }
+
Y_UNIT_TEST(LabelFor) {
- for (unsigned i = 0; i < TDurationHistogram::Buckets; ++i) {
- TDurationHistogram::LabelBefore(i);
- //Cerr << TDurationHistogram::LabelBefore(i) << "\n";
- }
- }
-}
+ for (unsigned i = 0; i < TDurationHistogram::Buckets; ++i) {
+ TDurationHistogram::LabelBefore(i);
+ //Cerr << TDurationHistogram::LabelBefore(i) << "\n";
+ }
+ }
+}