diff options
author | luxaeterna <luxaeterna@yandex-team.ru> | 2022-02-10 16:50:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:13 +0300 |
commit | 2c76d348a3be51f0875ddeaad6b2ccda604dee0f (patch) | |
tree | 054cd500011b8b97634220fc570d32a1d45fcc35 | |
parent | 9f848110233b3807d5dd3ae5479b3957d791892c (diff) | |
download | ydb-2c76d348a3be51f0875ddeaad6b2ccda604dee0f.tar.gz |
Restoring authorship annotation for <luxaeterna@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/logger/global/global.h | 2 | ||||
-rw-r--r-- | util/datetime/parser.h | 4 | ||||
-rw-r--r-- | util/datetime/parser.rl6 | 4 | ||||
-rw-r--r-- | util/datetime/parser_ut.cpp | 60 | ||||
-rw-r--r-- | util/generic/algorithm.h | 10 | ||||
-rw-r--r-- | util/generic/algorithm_ut.cpp | 28 |
6 files changed, 54 insertions, 54 deletions
diff --git a/library/cpp/logger/global/global.h b/library/cpp/logger/global/global.h index cbe71b16ea..e726173851 100644 --- a/library/cpp/logger/global/global.h +++ b/library/cpp/logger/global/global.h @@ -68,7 +68,7 @@ public: #define NOTICE_LOG SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, TLOG_NOTICE, "NOTICE") #define INFO_LOG SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, TLOG_INFO, "INFO") #define DEBUG_LOG SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, TLOG_DEBUG, "DEBUG") -#define RESOURCES_LOG SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, TLOG_RESOURCES, "RESOURCES") +#define RESOURCES_LOG SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, TLOG_RESOURCES, "RESOURCES") #define TEMPLATE_LOG(logLevel) SINGLETON_CHECKED_GENERIC_LOG(TGlobalLog, TRTYLogPreprocessor, logLevel, ToString(logLevel).data()) diff --git a/util/datetime/parser.h b/util/datetime/parser.h index f0c1b4a0c7..0c3b6dc570 100644 --- a/util/datetime/parser.h +++ b/util/datetime/parser.h @@ -53,8 +53,8 @@ struct TDateTimeFields { if (Minute > 59) return false; - // handle leap second which is explicitly allowed by ISO 8601:2004(E) $2.2.2 - // https://datatracker.ietf.org/doc/html/rfc3339#section-5.6 + // handle leap second which is explicitly allowed by ISO 8601:2004(E) $2.2.2 + // https://datatracker.ietf.org/doc/html/rfc3339#section-5.6 if (Second > 60) return false; diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6 index 931f09eae1..f36b6de219 100644 --- a/util/datetime/parser.rl6 +++ b/util/datetime/parser.rl6 @@ -206,14 +206,14 @@ secondFrac = digit {1,6} >clear_int $update_int @{ } DateTimeFields.MicroSecond = us; }; -secondFracTail = (digit*); +secondFracTail = (digit*); zoneZ = [Zz] @set_zone_utc; zoneOffset = space? . ('+' | '-') >{ Sign = fc == '+' ? 1 : -1; } . int2 @{ DateTimeFields.ZoneOffsetMinutes = Sign * (i32)TDuration::Hours(I).Minutes(); } . (':')? . (int2 @{ DateTimeFields.ZoneOffsetMinutes += I * Sign; })?; zone = zoneZ | zoneOffset; iso8601date = (year . '-' . month . '-' . day) | (year . month . day); -iso8601time = (hour . ':' . minute . (':' . second ('.' secondFrac secondFracTail)?)?) | (hour . minute . second?); +iso8601time = (hour . ':' . minute . (':' . second ('.' secondFrac secondFracTail)?)?) | (hour . minute . second?); iso8601datetime = iso8601date . ([Tt ] . iso8601time . zone?)?; diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index 61364af997..5946fbbc05 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -421,36 +421,36 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { TInstant::Seconds(1253317023) + TDuration::MicroSeconds(12331)); } - Y_UNIT_TEST(TestIso8601FractionsBelowMicro) { - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.0000000+00:00"), - TInstant::Seconds(0)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.0000009+00:00"), - TInstant::Seconds(0)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.000000789+00:00"), - TInstant::Seconds(0)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.1234560+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.1234569+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.123456789+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.9999990+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.9999999+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); - UNIT_ASSERT_VALUES_EQUAL( - TInstant::ParseIso8601("1970-01-01 00:00:00.999999789+00:00"), - TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); - } - + Y_UNIT_TEST(TestIso8601FractionsBelowMicro) { + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.0000000+00:00"), + TInstant::Seconds(0)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.0000009+00:00"), + TInstant::Seconds(0)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.000000789+00:00"), + TInstant::Seconds(0)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.1234560+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.1234569+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.123456789+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(123456)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.9999990+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.9999999+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); + UNIT_ASSERT_VALUES_EQUAL( + TInstant::ParseIso8601("1970-01-01 00:00:00.999999789+00:00"), + TInstant::Seconds(0) + TDuration::MicroSeconds(999999)); + } + Y_UNIT_TEST(TestIso8601BigDate) { TVector<std::pair<TString, int>> dates{ {"2019-01-01", 17897}, diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb88993..7e73f03f82 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -724,11 +724,11 @@ bool IsSorted(ForwardIt begin, ForwardIt end, Compare comp) { return std::is_sorted(begin, end, comp); } -template <class TIterator, typename TGetKey> -bool IsSortedBy(TIterator begin, TIterator end, const TGetKey& getKey) { - return IsSorted(begin, end, [&](auto&& left, auto&& right) { return getKey(left) < getKey(right); }); -} - +template <class TIterator, typename TGetKey> +bool IsSortedBy(TIterator begin, TIterator end, const TGetKey& getKey) { + return IsSorted(begin, end, [&](auto&& left, auto&& right) { return getKey(left) < getKey(right); }); +} + template <class It, class Val> void Iota(It begin, It end, Val val) { std::iota(begin, end, val); diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0c..71f6a3da8f 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -431,20 +431,20 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end(), TGreater<int>()), false); } - Y_UNIT_TEST(IsSortedByTest) { - TVector<int> v0; - UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v0.begin(), v0.end(), std::negate<int>()), true); - - TVector<int> v1 = {1}; - UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v1.begin(), v1.end(), std::negate<int>()), true); - - TVector<int> v2 = {8, 7, 6, 6, 5, 5, 5, 4, 3, 2, 1}; - UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v2.begin(), v2.end(), std::negate<int>()), true); - - TVector<int> v3 = {1, 2, 1}; - UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v3.begin(), v3.end(), std::negate<int>()), false); - } - + Y_UNIT_TEST(IsSortedByTest) { + TVector<int> v0; + UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v0.begin(), v0.end(), std::negate<int>()), true); + + TVector<int> v1 = {1}; + UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v1.begin(), v1.end(), std::negate<int>()), true); + + TVector<int> v2 = {8, 7, 6, 6, 5, 5, 5, 4, 3, 2, 1}; + UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v2.begin(), v2.end(), std::negate<int>()), true); + + TVector<int> v3 = {1, 2, 1}; + UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v3.begin(), v3.end(), std::negate<int>()), false); + } + Y_UNIT_TEST(SortTestTwoIterators) { TVector<int> collection = {10, 2, 7}; Sort(collection.begin(), collection.end()); |