diff options
author | Sergey Polovko <sergey@polovko.me> | 2022-02-10 16:47:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:02 +0300 |
commit | 3e0b762a82514bac89c1dd6ea7211e381d8aa248 (patch) | |
tree | c2d1b379ecaf05ca8f11ed0b5da9d1a950e6e554 /library/cpp/monlib/metrics/fake_ut.cpp | |
parent | ab3783171cc30e262243a0227c86118f7080c896 (diff) | |
download | ydb-3e0b762a82514bac89c1dd6ea7211e381d8aa248.tar.gz |
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/fake_ut.cpp')
-rw-r--r-- | library/cpp/monlib/metrics/fake_ut.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/monlib/metrics/fake_ut.cpp b/library/cpp/monlib/metrics/fake_ut.cpp index c3368ca302..af164f4628 100644 --- a/library/cpp/monlib/metrics/fake_ut.cpp +++ b/library/cpp/monlib/metrics/fake_ut.cpp @@ -1,34 +1,34 @@ -#include "fake.h" - -#include <library/cpp/testing/unittest/registar.h> - -#include <util/generic/ptr.h> - -using namespace NMonitoring; - -Y_UNIT_TEST_SUITE(TFakeTest) { - - Y_UNIT_TEST(CreateOnStack) { - TFakeMetricRegistry registry; - } - - Y_UNIT_TEST(CreateOnHeap) { - auto registry = MakeAtomicShared<TFakeMetricRegistry>(); - UNIT_ASSERT(registry); - } - - Y_UNIT_TEST(Gauge) { - TFakeMetricRegistry registry(TLabels{{"common", "label"}}); - - IGauge* g = registry.Gauge(MakeLabels({{"my", "gauge"}})); - UNIT_ASSERT(g); - - UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); - g->Set(12.34); - UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); // no changes - - double val = g->Add(1.2); - UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); - UNIT_ASSERT_DOUBLES_EQUAL(val, 0.0, 1E-6); - } -} +#include "fake.h" + +#include <library/cpp/testing/unittest/registar.h> + +#include <util/generic/ptr.h> + +using namespace NMonitoring; + +Y_UNIT_TEST_SUITE(TFakeTest) { + + Y_UNIT_TEST(CreateOnStack) { + TFakeMetricRegistry registry; + } + + Y_UNIT_TEST(CreateOnHeap) { + auto registry = MakeAtomicShared<TFakeMetricRegistry>(); + UNIT_ASSERT(registry); + } + + Y_UNIT_TEST(Gauge) { + TFakeMetricRegistry registry(TLabels{{"common", "label"}}); + + IGauge* g = registry.Gauge(MakeLabels({{"my", "gauge"}})); + UNIT_ASSERT(g); + + UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); + g->Set(12.34); + UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); // no changes + + double val = g->Add(1.2); + UNIT_ASSERT_DOUBLES_EQUAL(g->Get(), 0.0, 1E-6); + UNIT_ASSERT_DOUBLES_EQUAL(val, 0.0, 1E-6); + } +} |