diff options
author | gusev-p <gusev-p@yandex-team.ru> | 2022-02-10 16:47:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:20 +0300 |
commit | 1715700d00b30399d3648be821fd585ae552365e (patch) | |
tree | 6857a59158ea36e56d87fb32fbb8e44673c0ca0f /library/cpp/monlib/encode/json/json_decoder_ut.cpp | |
parent | b23c1d7a8015c2006a148fd93b84cdeb0aee17a3 (diff) | |
download | ydb-1715700d00b30399d3648be821fd585ae552365e.tar.gz |
Restoring authorship annotation for <gusev-p@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/json/json_decoder_ut.cpp')
-rw-r--r-- | library/cpp/monlib/encode/json/json_decoder_ut.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/library/cpp/monlib/encode/json/json_decoder_ut.cpp b/library/cpp/monlib/encode/json/json_decoder_ut.cpp index 4464e1d26a..52c34e4f37 100644 --- a/library/cpp/monlib/encode/json/json_decoder_ut.cpp +++ b/library/cpp/monlib/encode/json/json_decoder_ut.cpp @@ -120,60 +120,60 @@ Y_UNIT_TEST_SUITE(TJsonDecoderTest) { ValidateCommonParts(std::move(commonParts), true, true); ValidateMetrics(collector.Metrics); } - - Y_UNIT_TEST(CanParseHistogramsWithInf) { - const char* metricsData = R"({ -"metrics": - [ - { - "hist": { - "bounds": [ - 10 - ], - "buckets": [ - 11 - ], - "inf": 12 - }, - "name":"s1", - "type": "HIST_RATE" - }, - { - "hist": { - "bounds": [ - 20 - ], - "buckets": [ - 21 - ] - }, - "name":"s2", - "type":"HIST_RATE" - } - ] -})"; - TCollectingConsumer consumer(false); - DecodeJson(metricsData, &consumer); - - UNIT_ASSERT_VALUES_EQUAL(consumer.Metrics.size(), 2); - { - const auto& m = consumer.Metrics[0]; - UNIT_ASSERT_VALUES_EQUAL(m.Kind, EMetricType::HIST_RATE); - UNIT_ASSERT_VALUES_EQUAL(m.Values->Size(), 1); - const auto* histogram = (*m.Values)[0].GetValue().AsHistogram(); - UNIT_ASSERT_VALUES_EQUAL(histogram->Count(), 2); - UNIT_ASSERT_VALUES_EQUAL(histogram->UpperBound(1), Max<TBucketBound>()); - UNIT_ASSERT_VALUES_EQUAL(histogram->Value(0), 11); - UNIT_ASSERT_VALUES_EQUAL(histogram->Value(1), 12); - } - { - const auto& m = consumer.Metrics[1]; - UNIT_ASSERT_VALUES_EQUAL(m.Kind, EMetricType::HIST_RATE); - UNIT_ASSERT_VALUES_EQUAL(m.Values->Size(), 1); - const auto* histogram = (*m.Values)[0].GetValue().AsHistogram(); - UNIT_ASSERT_VALUES_EQUAL(histogram->Count(), 1); - UNIT_ASSERT_VALUES_EQUAL(histogram->UpperBound(0), 20); - UNIT_ASSERT_VALUES_EQUAL(histogram->Value(0), 21); - } - } + + Y_UNIT_TEST(CanParseHistogramsWithInf) { + const char* metricsData = R"({ +"metrics": + [ + { + "hist": { + "bounds": [ + 10 + ], + "buckets": [ + 11 + ], + "inf": 12 + }, + "name":"s1", + "type": "HIST_RATE" + }, + { + "hist": { + "bounds": [ + 20 + ], + "buckets": [ + 21 + ] + }, + "name":"s2", + "type":"HIST_RATE" + } + ] +})"; + TCollectingConsumer consumer(false); + DecodeJson(metricsData, &consumer); + + UNIT_ASSERT_VALUES_EQUAL(consumer.Metrics.size(), 2); + { + const auto& m = consumer.Metrics[0]; + UNIT_ASSERT_VALUES_EQUAL(m.Kind, EMetricType::HIST_RATE); + UNIT_ASSERT_VALUES_EQUAL(m.Values->Size(), 1); + const auto* histogram = (*m.Values)[0].GetValue().AsHistogram(); + UNIT_ASSERT_VALUES_EQUAL(histogram->Count(), 2); + UNIT_ASSERT_VALUES_EQUAL(histogram->UpperBound(1), Max<TBucketBound>()); + UNIT_ASSERT_VALUES_EQUAL(histogram->Value(0), 11); + UNIT_ASSERT_VALUES_EQUAL(histogram->Value(1), 12); + } + { + const auto& m = consumer.Metrics[1]; + UNIT_ASSERT_VALUES_EQUAL(m.Kind, EMetricType::HIST_RATE); + UNIT_ASSERT_VALUES_EQUAL(m.Values->Size(), 1); + const auto* histogram = (*m.Values)[0].GetValue().AsHistogram(); + UNIT_ASSERT_VALUES_EQUAL(histogram->Count(), 1); + UNIT_ASSERT_VALUES_EQUAL(histogram->UpperBound(0), 20); + UNIT_ASSERT_VALUES_EQUAL(histogram->Value(0), 21); + } + } } |