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/encode/buffered | |
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/encode/buffered')
-rw-r--r-- | library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp | 102 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/buffered_encoder_base.h | 38 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/string_pool.cpp | 66 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/string_pool.h | 130 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/string_pool_ut.cpp | 126 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/ut/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/monlib/encode/buffered/ya.make | 4 |
7 files changed, 234 insertions, 234 deletions
diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp index 87c832d642..b3d86b57ea 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp @@ -18,57 +18,57 @@ void TBufferedEncoderBase::OnCommonTime(TInstant time) { CommonTime_ = time; } -void TBufferedEncoderBase::OnMetricBegin(EMetricType type) { - State_.Switch(TEncoderState::EState::ROOT, TEncoderState::EState::METRIC); - Metrics_.emplace_back(); - Metrics_.back().MetricType = type; +void TBufferedEncoderBase::OnMetricBegin(EMetricType type) { + State_.Switch(TEncoderState::EState::ROOT, TEncoderState::EState::METRIC); + Metrics_.emplace_back(); + Metrics_.back().MetricType = type; } -void TBufferedEncoderBase::OnMetricEnd() { - State_.Switch(TEncoderState::EState::METRIC, TEncoderState::EState::ROOT); +void TBufferedEncoderBase::OnMetricEnd() { + State_.Switch(TEncoderState::EState::METRIC, TEncoderState::EState::ROOT); - switch (MetricsMergingMode_) { - case EMetricsMergingMode::MERGE_METRICS: { - auto& metric = Metrics_.back(); - Sort(metric.Labels, [] (const TPooledLabel& lhs, const TPooledLabel& rhs) { + switch (MetricsMergingMode_) { + case EMetricsMergingMode::MERGE_METRICS: { + auto& metric = Metrics_.back(); + Sort(metric.Labels, [] (const TPooledLabel& lhs, const TPooledLabel& rhs) { return std::tie(lhs.Key, lhs.Value) < std::tie(rhs.Key, rhs.Value); }); - auto it = MetricMap_.find(metric.Labels); - if (it == std::end(MetricMap_)) { - MetricMap_.emplace(metric.Labels, Metrics_.size() - 1); + auto it = MetricMap_.find(metric.Labels); + if (it == std::end(MetricMap_)) { + MetricMap_.emplace(metric.Labels, Metrics_.size() - 1); } else { - auto& existing = Metrics_[it->second].TimeSeries; + auto& existing = Metrics_[it->second].TimeSeries; - Y_ENSURE(existing.GetValueType() == metric.TimeSeries.GetValueType(), + Y_ENSURE(existing.GetValueType() == metric.TimeSeries.GetValueType(), "Time series point type mismatch: expected " << existing.GetValueType() << " but found " << metric.TimeSeries.GetValueType() << ", labels '" << FormatLabels(metric.Labels) << "'"); - existing.CopyFrom(metric.TimeSeries); - Metrics_.pop_back(); + existing.CopyFrom(metric.TimeSeries); + Metrics_.pop_back(); } break; } - case EMetricsMergingMode::DEFAULT: + case EMetricsMergingMode::DEFAULT: break; } } void TBufferedEncoderBase::OnLabelsBegin() { - if (State_ == TEncoderState::EState::METRIC) { - State_ = TEncoderState::EState::METRIC_LABELS; + if (State_ == TEncoderState::EState::METRIC) { + State_ = TEncoderState::EState::METRIC_LABELS; } else if (State_ == TEncoderState::EState::ROOT) { State_ = TEncoderState::EState::COMMON_LABELS; } else { - State_.ThrowInvalid("expected METRIC or ROOT"); + State_.ThrowInvalid("expected METRIC or ROOT"); } } void TBufferedEncoderBase::OnLabelsEnd() { - if (State_ == TEncoderState::EState::METRIC_LABELS) { - State_ = TEncoderState::EState::METRIC; + if (State_ == TEncoderState::EState::METRIC_LABELS) { + State_ = TEncoderState::EState::METRIC; } else if (State_ == TEncoderState::EState::COMMON_LABELS) { State_ = TEncoderState::EState::ROOT; } else { @@ -76,10 +76,10 @@ void TBufferedEncoderBase::OnLabelsEnd() { } } -void TBufferedEncoderBase::OnLabel(TStringBuf name, TStringBuf value) { +void TBufferedEncoderBase::OnLabel(TStringBuf name, TStringBuf value) { TPooledLabels* labels; - if (State_ == TEncoderState::EState::METRIC_LABELS) { - labels = &Metrics_.back().Labels; + if (State_ == TEncoderState::EState::METRIC_LABELS) { + labels = &Metrics_.back().Labels; } else if (State_ == TEncoderState::EState::COMMON_LABELS) { labels = &CommonLabels_; } else { @@ -102,46 +102,46 @@ void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) { labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value)); } -std::pair<ui32, ui32> TBufferedEncoderBase::PrepareLabel(TStringBuf name, TStringBuf value) { +std::pair<ui32, ui32> TBufferedEncoderBase::PrepareLabel(TStringBuf name, TStringBuf value) { auto nameLabel = LabelNamesPool_.PutIfAbsent(name); auto valueLabel = LabelValuesPool_.PutIfAbsent(value); return std::make_pair(nameLabel->Index, valueLabel->Index); } void TBufferedEncoderBase::OnDouble(TInstant time, double value) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, value); -} - -void TBufferedEncoderBase::OnInt64(TInstant time, i64 value) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, value); + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, value); } +void TBufferedEncoderBase::OnInt64(TInstant time, i64 value) { + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, value); +} + void TBufferedEncoderBase::OnUint64(TInstant time, ui64 value) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, value); -} - -void TBufferedEncoderBase::OnHistogram(TInstant time, IHistogramSnapshotPtr s) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, s.Get()); + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, value); } +void TBufferedEncoderBase::OnHistogram(TInstant time, IHistogramSnapshotPtr s) { + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, s.Get()); +} + void TBufferedEncoderBase::OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr s) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, s.Get()); + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, s.Get()); } void TBufferedEncoderBase::OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr s) { - State_.Expect(TEncoderState::EState::METRIC); - TMetric& metric = Metrics_.back(); - metric.TimeSeries.Add(time, s.Get()); + State_.Expect(TEncoderState::EState::METRIC); + TMetric& metric = Metrics_.back(); + metric.TimeSeries.Add(time, s.Get()); } TString TBufferedEncoderBase::FormatLabels(const TPooledLabels& labels) const { diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h index fe3714e58f..d57ed5cd14 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h @@ -2,10 +2,10 @@ #include "string_pool.h" -#include <library/cpp/monlib/encode/encoder.h> -#include <library/cpp/monlib/encode/encoder_state.h> -#include <library/cpp/monlib/encode/format.h> -#include <library/cpp/monlib/metrics/metric_value.h> +#include <library/cpp/monlib/encode/encoder.h> +#include <library/cpp/monlib/encode/encoder_state.h> +#include <library/cpp/monlib/encode/format.h> +#include <library/cpp/monlib/metrics/metric_value.h> #include <util/datetime/base.h> #include <util/digest/numeric.h> @@ -13,30 +13,30 @@ namespace NMonitoring { -class TBufferedEncoderBase : public IMetricEncoder { +class TBufferedEncoderBase : public IMetricEncoder { public: void OnStreamBegin() override; void OnStreamEnd() override; void OnCommonTime(TInstant time) override; - void OnMetricBegin(EMetricType type) override; - void OnMetricEnd() override; + void OnMetricBegin(EMetricType type) override; + void OnMetricEnd() override; void OnLabelsBegin() override; void OnLabelsEnd() override; - void OnLabel(TStringBuf name, TStringBuf value) override; + void OnLabel(TStringBuf name, TStringBuf value) override; void OnLabel(ui32 name, ui32 value) override; - std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value) override; + std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value) override; void OnDouble(TInstant time, double value) override; - void OnInt64(TInstant time, i64 value) override; + void OnInt64(TInstant time, i64 value) override; void OnUint64(TInstant time, ui64 value) override; - void OnHistogram(TInstant time, IHistogramSnapshotPtr snapshot) override; + void OnHistogram(TInstant time, IHistogramSnapshotPtr snapshot) override; void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override; void OnLogHistogram(TInstant, TLogHistogramSnapshotPtr) override; - + protected: using TPooledStr = TStringPoolBuilder::TValue; @@ -74,12 +74,12 @@ protected: } }; - using TMetricMap = THashMap<TPooledLabels, size_t, TPooledLabelsHash>; + using TMetricMap = THashMap<TPooledLabels, size_t, TPooledLabelsHash>; - struct TMetric { - EMetricType MetricType = EMetricType::UNKNOWN; + struct TMetric { + EMetricType MetricType = EMetricType::UNKNOWN; TPooledLabels Labels; - TMetricTimeSeries TimeSeries; + TMetricTimeSeries TimeSeries; }; protected: @@ -92,9 +92,9 @@ protected: TStringPoolBuilder LabelValuesPool_; TInstant CommonTime_ = TInstant::Zero(); TPooledLabels CommonLabels_; - TVector<TMetric> Metrics_; - TMetricMap MetricMap_; - EMetricsMergingMode MetricsMergingMode_ = EMetricsMergingMode::DEFAULT; + TVector<TMetric> Metrics_; + TMetricMap MetricMap_; + EMetricsMergingMode MetricsMergingMode_ = EMetricsMergingMode::DEFAULT; }; } diff --git a/library/cpp/monlib/encode/buffered/string_pool.cpp b/library/cpp/monlib/encode/buffered/string_pool.cpp index b4c7988ba3..2015ae9860 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool.cpp @@ -1,24 +1,24 @@ -#include "string_pool.h" - -namespace NMonitoring { - //////////////////////////////////////////////////////////////////////////////// - // TStringPoolBuilder - //////////////////////////////////////////////////////////////////////////////// - const TStringPoolBuilder::TValue* TStringPoolBuilder::PutIfAbsent(TStringBuf str) { +#include "string_pool.h" + +namespace NMonitoring { + //////////////////////////////////////////////////////////////////////////////// + // TStringPoolBuilder + //////////////////////////////////////////////////////////////////////////////// + const TStringPoolBuilder::TValue* TStringPoolBuilder::PutIfAbsent(TStringBuf str) { Y_ENSURE(!IsBuilt_, "Cannot add more values after string has been built"); - + auto [it, isInserted] = StrMap_.try_emplace(str, Max<ui32>(), 0); if (isInserted) { BytesSize_ += str.size(); it->second.Index = StrVector_.size(); StrVector_.emplace_back(it->first, &it->second); - } + } TValue* value = &it->second; - ++value->Frequency; - return value; - } - + ++value->Frequency; + return value; + } + const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const { return StrVector_.at(index).second; } @@ -29,30 +29,30 @@ namespace NMonitoring { std::sort(StrVector_.begin(), StrVector_.end(), [](auto& a, auto& b) { return a.second->Frequency > b.second->Frequency; }); - + ui32 i = 0; for (auto& value : StrVector_) { value.second->Index = i++; } - } - + } + IsBuilt_ = true; return *this; - } - - //////////////////////////////////////////////////////////////////////////////// - // TStringPool - //////////////////////////////////////////////////////////////////////////////// - void TStringPool::InitIndex(const char* data, ui32 size) { - const char* begin = data; - const char* end = begin + size; - for (const char* p = begin; p != end; ++p) { - if (*p == '\0') { - Index_.push_back(TStringBuf(begin, p)); - begin = p + 1; - } - } - } - -} + } + + //////////////////////////////////////////////////////////////////////////////// + // TStringPool + //////////////////////////////////////////////////////////////////////////////// + void TStringPool::InitIndex(const char* data, ui32 size) { + const char* begin = data; + const char* end = begin + size; + for (const char* p = begin; p != end; ++p) { + if (*p == '\0') { + Index_.push_back(TStringBuf(begin, p)); + begin = p + 1; + } + } + } + +} diff --git a/library/cpp/monlib/encode/buffered/string_pool.h b/library/cpp/monlib/encode/buffered/string_pool.h index 00e5644608..2d67fd37a3 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.h +++ b/library/cpp/monlib/encode/buffered/string_pool.h @@ -1,14 +1,14 @@ -#pragma once - -#include <util/generic/hash.h> -#include <util/generic/vector.h> - -namespace NMonitoring { - //////////////////////////////////////////////////////////////////////////////// - // TStringPoolBuilder - //////////////////////////////////////////////////////////////////////////////// - class TStringPoolBuilder { - public: +#pragma once + +#include <util/generic/hash.h> +#include <util/generic/vector.h> + +namespace NMonitoring { + //////////////////////////////////////////////////////////////////////////////// + // TStringPoolBuilder + //////////////////////////////////////////////////////////////////////////////// + class TStringPoolBuilder { + public: struct TValue: TNonCopyable { TValue(ui32 idx, ui32 freq) : Index{idx} @@ -16,77 +16,77 @@ namespace NMonitoring { { } - ui32 Index; - ui32 Frequency; - }; - - public: - const TValue* PutIfAbsent(TStringBuf str); + ui32 Index; + ui32 Frequency; + }; + + public: + const TValue* PutIfAbsent(TStringBuf str); const TValue* GetByIndex(ui32 index) const; - + /// Determines whether pool must be sorted by value frequencies TStringPoolBuilder& SetSorted(bool sorted) { RequiresSorting_ = sorted; return *this; } - + TStringPoolBuilder& Build(); - TStringBuf Get(ui32 index) const { + TStringBuf Get(ui32 index) const { Y_ENSURE(IsBuilt_, "Pool must be sorted first"); - return StrVector_.at(index).first; - } - + return StrVector_.at(index).first; + } + TStringBuf Get(const TValue* value) const { return StrVector_.at(value->Index).first; } - template <typename TConsumer> - void ForEach(TConsumer&& c) { + template <typename TConsumer> + void ForEach(TConsumer&& c) { Y_ENSURE(IsBuilt_, "Pool must be sorted first"); - for (const auto& value : StrVector_) { - c(value.first, value.second->Index, value.second->Frequency); - } - } - - size_t BytesSize() const noexcept { - return BytesSize_; - } - - size_t Count() const noexcept { - return StrMap_.size(); - } - - private: - THashMap<TString, TValue> StrMap_; - TVector<std::pair<TStringBuf, TValue*>> StrVector_; + for (const auto& value : StrVector_) { + c(value.first, value.second->Index, value.second->Frequency); + } + } + + size_t BytesSize() const noexcept { + return BytesSize_; + } + + size_t Count() const noexcept { + return StrMap_.size(); + } + + private: + THashMap<TString, TValue> StrMap_; + TVector<std::pair<TStringBuf, TValue*>> StrVector_; bool RequiresSorting_ = false; bool IsBuilt_ = false; - size_t BytesSize_ = 0; - }; - - //////////////////////////////////////////////////////////////////////////////// - // TStringPool - //////////////////////////////////////////////////////////////////////////////// - class TStringPool { - public: - TStringPool(const char* data, ui32 size) { - InitIndex(data, size); - } - - TStringBuf Get(ui32 i) const { - return Index_.at(i); - } - + size_t BytesSize_ = 0; + }; + + //////////////////////////////////////////////////////////////////////////////// + // TStringPool + //////////////////////////////////////////////////////////////////////////////// + class TStringPool { + public: + TStringPool(const char* data, ui32 size) { + InitIndex(data, size); + } + + TStringBuf Get(ui32 i) const { + return Index_.at(i); + } + size_t Size() const { return Index_.size(); } - private: - void InitIndex(const char* data, ui32 size); - - private: - TVector<TStringBuf> Index_; - }; - -} + private: + void InitIndex(const char* data, ui32 size); + + private: + TVector<TStringBuf> Index_; + }; + +} diff --git a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp index 9fc3421d0b..7f8b4c6724 100644 --- a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp @@ -1,84 +1,84 @@ -#include "string_pool.h" - +#include "string_pool.h" + #include <library/cpp/testing/unittest/registar.h> - -using namespace NMonitoring; - + +using namespace NMonitoring; + Y_UNIT_TEST_SUITE(TStringPoolTest) { Y_UNIT_TEST(PutIfAbsent) { - TStringPoolBuilder strPool; + TStringPoolBuilder strPool; strPool.SetSorted(true); - auto* h1 = strPool.PutIfAbsent("one"); - auto* h2 = strPool.PutIfAbsent("two"); - auto* h3 = strPool.PutIfAbsent("two"); - UNIT_ASSERT(h1 != h2); - UNIT_ASSERT(h2 == h3); - - UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); + auto* h1 = strPool.PutIfAbsent("one"); + auto* h2 = strPool.PutIfAbsent("two"); + auto* h3 = strPool.PutIfAbsent("two"); + UNIT_ASSERT(h1 != h2); + UNIT_ASSERT(h2 == h3); + + UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0); - - UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); + + UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1); - - UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6); - UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); - } - + + UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6); + UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); + } + Y_UNIT_TEST(SortByFrequency) { - TStringPoolBuilder strPool; + TStringPoolBuilder strPool; strPool.SetSorted(true); - auto* h1 = strPool.PutIfAbsent("one"); - auto* h2 = strPool.PutIfAbsent("two"); - auto* h3 = strPool.PutIfAbsent("two"); - UNIT_ASSERT(h1 != h2); - UNIT_ASSERT(h2 == h3); - + auto* h1 = strPool.PutIfAbsent("one"); + auto* h2 = strPool.PutIfAbsent("two"); + auto* h3 = strPool.PutIfAbsent("two"); + UNIT_ASSERT(h1 != h2); + UNIT_ASSERT(h2 == h3); + strPool.Build(); - - UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); - UNIT_ASSERT_VALUES_EQUAL(h1->Index, 1); - - UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); - UNIT_ASSERT_VALUES_EQUAL(h2->Index, 0); - - UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6); - UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); - } - + + UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); + UNIT_ASSERT_VALUES_EQUAL(h1->Index, 1); + + UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); + UNIT_ASSERT_VALUES_EQUAL(h2->Index, 0); + + UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6); + UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); + } + Y_UNIT_TEST(ForEach) { - TStringPoolBuilder strPool; + TStringPoolBuilder strPool; strPool.SetSorted(true); - strPool.PutIfAbsent("one"); - strPool.PutIfAbsent("two"); - strPool.PutIfAbsent("two"); - strPool.PutIfAbsent("three"); - strPool.PutIfAbsent("three"); - strPool.PutIfAbsent("three"); - - UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 11); - UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 3); - + strPool.PutIfAbsent("one"); + strPool.PutIfAbsent("two"); + strPool.PutIfAbsent("two"); + strPool.PutIfAbsent("three"); + strPool.PutIfAbsent("three"); + strPool.PutIfAbsent("three"); + + UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 11); + UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 3); + strPool.Build(); - + TVector<TString> strings; TVector<ui32> indexes; TVector<ui32> frequences; - strPool.ForEach([&](TStringBuf str, ui32 index, ui32 freq) { - strings.emplace_back(str); - indexes.push_back(index); - frequences.push_back(freq); - }); - + strPool.ForEach([&](TStringBuf str, ui32 index, ui32 freq) { + strings.emplace_back(str); + indexes.push_back(index); + frequences.push_back(freq); + }); + TVector<TString> expectedStrings = {"three", "two", "one"}; - UNIT_ASSERT_EQUAL(strings, expectedStrings); - + UNIT_ASSERT_EQUAL(strings, expectedStrings); + TVector<ui32> expectedIndexes = {0, 1, 2}; - UNIT_ASSERT_EQUAL(indexes, expectedIndexes); - + UNIT_ASSERT_EQUAL(indexes, expectedIndexes); + TVector<ui32> expectedFrequences = {3, 2, 1}; - UNIT_ASSERT_EQUAL(frequences, expectedFrequences); - } -} + UNIT_ASSERT_EQUAL(frequences, expectedFrequences); + } +} diff --git a/library/cpp/monlib/encode/buffered/ut/ya.make b/library/cpp/monlib/encode/buffered/ut/ya.make index 2157ac1490..af2e09ac67 100644 --- a/library/cpp/monlib/encode/buffered/ut/ya.make +++ b/library/cpp/monlib/encode/buffered/ut/ya.make @@ -1,4 +1,4 @@ -UNITTEST_FOR(library/cpp/monlib/encode/buffered) +UNITTEST_FOR(library/cpp/monlib/encode/buffered) OWNER( g:solomon diff --git a/library/cpp/monlib/encode/buffered/ya.make b/library/cpp/monlib/encode/buffered/ya.make index 81b6a78b93..edaf29aa93 100644 --- a/library/cpp/monlib/encode/buffered/ya.make +++ b/library/cpp/monlib/encode/buffered/ya.make @@ -12,8 +12,8 @@ SRCS( ) PEERDIR( - library/cpp/monlib/encode - library/cpp/monlib/metrics + library/cpp/monlib/encode + library/cpp/monlib/metrics ) END() |