aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authornkmakarov <nkmakarov@yandex-team.ru>2022-02-10 16:49:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:06 +0300
commitf1803fa4ac9e2ee6cbfde317571ec330013392ff (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parent324348a37ed08cf66897faefb0ec4bebfe7804e1 (diff)
downloadydb-f1803fa4ac9e2ee6cbfde317571ec330013392ff.tar.gz
Restoring authorship annotation for <nkmakarov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/cache/thread_safe_cache.h46
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp68
-rw-r--r--library/cpp/deprecated/ya.make2
-rw-r--r--library/cpp/getopt/small/modchooser.cpp2
-rw-r--r--library/cpp/getopt/ut/modchooser_ut.cpp78
-rw-r--r--library/cpp/getopt/ut/ya.make2
-rw-r--r--library/cpp/linear_regression/linear_model.h4
-rw-r--r--library/cpp/linear_regression/linear_regression_ut.cpp140
-rw-r--r--library/cpp/linear_regression/welford.cpp26
-rw-r--r--library/cpp/linear_regression/welford.h10
-rw-r--r--library/cpp/scheme/tests/ut/scheme_path_ut.cpp12
-rw-r--r--library/cpp/scheme/tests/ut/scheme_ut.cpp8
-rw-r--r--library/cpp/testing/unittest/registar.h4
-rw-r--r--library/cpp/testing/unittest/ut/main.cpp10
-rw-r--r--library/cpp/threading/skip_list/perf/main.cpp2
15 files changed, 207 insertions, 207 deletions
diff --git a/library/cpp/cache/thread_safe_cache.h b/library/cpp/cache/thread_safe_cache.h
index 396ddec757..71e1442717 100644
--- a/library/cpp/cache/thread_safe_cache.h
+++ b/library/cpp/cache/thread_safe_cache.h
@@ -50,13 +50,13 @@ namespace NPrivate {
}
const TPtr Get(TArgs... args) const {
- return GetValue<true>(args...);
+ return GetValue<true>(args...);
+ }
+
+ const TPtr GetUnsafe(TArgs... args) const {
+ return GetValue<false>(args...);
}
- const TPtr GetUnsafe(TArgs... args) const {
- return GetValue<false>(args...);
- }
-
void Clear() {
TWriteGuard w(Mutex);
Cache.Clear();
@@ -107,9 +107,9 @@ namespace NPrivate {
}
private:
- template <bool AllowNullValues>
- const TPtr GetValue(TArgs... args) const {
- Key key = Callbacks.GetKey(args...);
+ template <bool AllowNullValues>
+ const TPtr GetValue(TArgs... args) const {
+ Key key = Callbacks.GetKey(args...);
switch (GettersPromotionPolicy) {
case EGettersPromotionPolicy::Promoted:
break;
@@ -120,21 +120,21 @@ namespace NPrivate {
return i.Value();
}
break;
- }
- }
- TWriteGuard w(Mutex);
- typename TInternalCache::TIterator i = Cache.Find(key);
- if (i != Cache.End()) {
- return i.Value();
- }
- TPtr value = Callbacks.CreateObject(args...);
- if (value || AllowNullValues) {
- Cache.Insert(key, value);
- }
- return value;
- }
-
- private:
+ }
+ }
+ TWriteGuard w(Mutex);
+ typename TInternalCache::TIterator i = Cache.Find(key);
+ if (i != Cache.End()) {
+ return i.Value();
+ }
+ TPtr value = Callbacks.CreateObject(args...);
+ if (value || AllowNullValues) {
+ Cache.Insert(key, value);
+ }
+ return value;
+ }
+
+ private:
using TInternalCache = TCache<Key, TPtr, List<Key, TPtr>, TNoopDelete>;
template <class TCallbacks>
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index 2a9af30d10..329872cfde 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -376,7 +376,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
};
Y_UNIT_TEST(SimpleTest) {
- for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
+ for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
const TString data = *TCache::Get<TCallbacks>(i);
UNIT_ASSERT(data == VALS[i]);
}
@@ -405,39 +405,39 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
UNIT_ASSERT(*item == "hjk");
}
}
-
-Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) {
- typedef TThreadSafeCache<ui32, TString, ui32> TCache;
-
- const char* VALS[] = {"abcd", "defg", "hjkl"};
- const ui32 FAILED_IDX = 1;
-
- class TCallbacks: public TCache::ICallbacks {
- public:
- TKey GetKey(ui32 i) const override {
- return i;
- }
- TValue* CreateObject(ui32 i) const override {
- if (i == FAILED_IDX) {
- return nullptr;
- }
- return new TString(VALS[i]);
- }
- };
-
- Y_UNIT_TEST(SimpleTest) {
- TCallbacks callbacks;
- TCache cache(callbacks, Y_ARRAY_SIZE(VALS));
- for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
- const TString* data = cache.GetUnsafe(i).Get();
- if (i == FAILED_IDX) {
- UNIT_ASSERT(data == nullptr);
- } else {
- UNIT_ASSERT(*data == VALS[i]);
- }
- }
- }
-}
+
+Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) {
+ typedef TThreadSafeCache<ui32, TString, ui32> TCache;
+
+ const char* VALS[] = {"abcd", "defg", "hjkl"};
+ const ui32 FAILED_IDX = 1;
+
+ class TCallbacks: public TCache::ICallbacks {
+ public:
+ TKey GetKey(ui32 i) const override {
+ return i;
+ }
+ TValue* CreateObject(ui32 i) const override {
+ if (i == FAILED_IDX) {
+ return nullptr;
+ }
+ return new TString(VALS[i]);
+ }
+ };
+
+ Y_UNIT_TEST(SimpleTest) {
+ TCallbacks callbacks;
+ TCache cache(callbacks, Y_ARRAY_SIZE(VALS));
+ for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
+ const TString* data = cache.GetUnsafe(i).Get();
+ if (i == FAILED_IDX) {
+ UNIT_ASSERT(data == nullptr);
+ } else {
+ UNIT_ASSERT(*data == VALS[i]);
+ }
+ }
+ }
+}
Y_UNIT_TEST_SUITE(TThreadSafeLRUCacheTest) {
typedef TThreadSafeLRUCache<size_t, TString, size_t> TCache;
diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make
index 301adff9ae..6c753f68a9 100644
--- a/library/cpp/deprecated/ya.make
+++ b/library/cpp/deprecated/ya.make
@@ -28,7 +28,7 @@ RECURSE(
omni/print_omni
omni/usage
omni/ut
- prog_options
+ prog_options
prog_options/ut
sgi_hash
threadable
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp
index 020de1c9df..2fa5cfd070 100644
--- a/library/cpp/getopt/small/modchooser.cpp
+++ b/library/cpp/getopt/small/modchooser.cpp
@@ -70,7 +70,7 @@ TModChooser::TMode::TMode(const TString& name, TMainClass* main, const TString&
}
TModChooser::TModChooser()
- : ModesHelpOption("-?") // Default help option in last_getopt
+ : ModesHelpOption("-?") // Default help option in last_getopt
, VersionHandler(nullptr)
, ShowSeparated(true)
, SvnRevisionOptionDisabled(false)
diff --git a/library/cpp/getopt/ut/modchooser_ut.cpp b/library/cpp/getopt/ut/modchooser_ut.cpp
index f756a4c8fb..a14c8a5853 100644
--- a/library/cpp/getopt/ut/modchooser_ut.cpp
+++ b/library/cpp/getopt/ut/modchooser_ut.cpp
@@ -1,9 +1,9 @@
#include <library/cpp/getopt/modchooser.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/str.h>
-
+
+#include <util/stream/str.h>
+
void ValidateArgcArgv(int argc, const char** argv) {
UNIT_ASSERT_EQUAL(argc, 1);
UNIT_ASSERT_EQUAL(argv[argc], nullptr);
@@ -11,61 +11,61 @@ void ValidateArgcArgv(int argc, const char** argv) {
int One(int argc, const char** argv) {
ValidateArgcArgv(argc, argv);
- return 1;
-}
-
+ return 1;
+}
+
int Two(int argc, const char** argv) {
ValidateArgcArgv(argc, argv);
- return 2;
-}
-
+ return 2;
+}
+
int Three(int argc, const char** argv) {
ValidateArgcArgv(argc, argv);
- return 3;
-}
-
+ return 3;
+}
+
int Four(int argc, const char** argv) {
ValidateArgcArgv(argc, argv);
- return 4;
-}
-
+ return 4;
+}
+
int Five(int argc, const char** argv) {
ValidateArgcArgv(argc, argv);
- return 5;
-}
-
-typedef int (*F_PTR)(int, const char**);
-static const F_PTR FUNCTIONS[] = {One, Two, Three, Four, Five};
-static const char* NAMES[] = {"one", "two", "three", "four", "five"};
+ return 5;
+}
+
+typedef int (*F_PTR)(int, const char**);
+static const F_PTR FUNCTIONS[] = {One, Two, Three, Four, Five};
+static const char* NAMES[] = {"one", "two", "three", "four", "five"};
static_assert(Y_ARRAY_SIZE(FUNCTIONS) == Y_ARRAY_SIZE(NAMES), "Incorrect input tests data");
-
+
Y_UNIT_TEST_SUITE(TModChooserTest) {
Y_UNIT_TEST(TestModesSimpleRunner) {
- TModChooser chooser;
+ TModChooser chooser;
for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
- chooser.AddMode(NAMES[idx], FUNCTIONS[idx], NAMES[idx]);
- }
-
+ chooser.AddMode(NAMES[idx], FUNCTIONS[idx], NAMES[idx]);
+ }
+
// test argc, argv
for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
- int argc = 2;
+ int argc = 2;
const char* argv[] = {"UNITTEST", NAMES[idx], nullptr};
- UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argc, argv));
- }
+ UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argc, argv));
+ }
// test TVector<TString> argv
for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
const TVector<TString> argv = {"UNITTEST", NAMES[idx]};
UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argv));
}
- }
-
+ }
+
Y_UNIT_TEST(TestHelpMessage) {
- TModChooser chooser;
-
- int argc = 2;
+ TModChooser chooser;
+
+ int argc = 2;
const char* argv[] = {"UNITTEST", "-?", nullptr};
-
- chooser.Run(argc, argv);
- }
-}
+
+ chooser.Run(argc, argv);
+ }
+}
diff --git a/library/cpp/getopt/ut/ya.make b/library/cpp/getopt/ut/ya.make
index 2d3b4625e0..8d00669efb 100644
--- a/library/cpp/getopt/ut/ya.make
+++ b/library/cpp/getopt/ut/ya.make
@@ -4,7 +4,7 @@ OWNER(pg)
SRCS(
last_getopt_ut.cpp
- modchooser_ut.cpp
+ modchooser_ut.cpp
opt2_ut.cpp
opt_ut.cpp
posix_getopt_ut.cpp
diff --git a/library/cpp/linear_regression/linear_model.h b/library/cpp/linear_regression/linear_model.h
index 4efd857374..8bb050cff7 100644
--- a/library/cpp/linear_regression/linear_model.h
+++ b/library/cpp/linear_regression/linear_model.h
@@ -5,8 +5,8 @@
#include <util/ysaveload.h>
-#include <utility>
-
+#include <utility>
+
class TLinearModel {
private:
TVector<double> Coefficients;
diff --git a/library/cpp/linear_regression/linear_regression_ut.cpp b/library/cpp/linear_regression/linear_regression_ut.cpp
index 0a31a6e25c..e71a16b67a 100644
--- a/library/cpp/linear_regression/linear_regression_ut.cpp
+++ b/library/cpp/linear_regression/linear_regression_ut.cpp
@@ -298,77 +298,77 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) {
Y_UNIT_TEST(SigmaTest10000000) {
TransformationTest(ETransformationType::TT_SIGMA, 10000000);
}
-
+
Y_UNIT_TEST(ResetCalculatorTest) {
TVector<double> arguments;
TVector<double> weights;
- const double eps = 1e-10;
-
- const size_t argumentsCount = 100;
- for (size_t i = 0; i < argumentsCount; ++i) {
- arguments.push_back(i);
- weights.push_back(i);
- }
-
- TDeviationCalculator deviationCalculator1, deviationCalculator2;
- TMeanCalculator meanCalculator1, meanCalculator2;
- TCovariationCalculator covariationCalculator1, covariationCalculator2;
- for (size_t i = 0; i < arguments.size(); ++i) {
- meanCalculator1.Add(arguments[i], weights[i]);
- meanCalculator2.Add(arguments[i], weights[i]);
- deviationCalculator1.Add(arguments[i], weights[i]);
- deviationCalculator2.Add(arguments[i], weights[i]);
- covariationCalculator1.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
- covariationCalculator2.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
- }
-
- UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetMean(), meanCalculator2.GetMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetSumWeights(), meanCalculator2.GetSumWeights(), eps);
-
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetMean(), deviationCalculator2.GetMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetDeviation(), deviationCalculator2.GetDeviation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetStdDev(), deviationCalculator2.GetStdDev(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetSumWeights(), deviationCalculator2.GetSumWeights(), eps);
-
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetFirstValueMean(), covariationCalculator2.GetFirstValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSecondValueMean(), covariationCalculator2.GetSecondValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetCovariation(), covariationCalculator2.GetCovariation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSumWeights(), covariationCalculator2.GetSumWeights(), eps);
-
- meanCalculator2.Reset();
- deviationCalculator2.Reset();
- covariationCalculator2.Reset();
-
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, meanCalculator2.GetMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, meanCalculator2.GetSumWeights(), eps);
-
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetDeviation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetStdDev(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetSumWeights(), eps);
-
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetFirstValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetSecondValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetCovariation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetSumWeights(), eps);
-
- for (size_t i = 0; i < arguments.size(); ++i) {
- meanCalculator2.Add(arguments[i], weights[i]);
- deviationCalculator2.Add(arguments[i], weights[i]);
- covariationCalculator2.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
- }
-
- UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetMean(), meanCalculator2.GetMean(), 1e-10);
- UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetSumWeights(), meanCalculator2.GetSumWeights(), 1e-10);
-
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetMean(), deviationCalculator2.GetMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetDeviation(), deviationCalculator2.GetDeviation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetStdDev(), deviationCalculator2.GetStdDev(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetSumWeights(), deviationCalculator2.GetSumWeights(), eps);
-
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetFirstValueMean(), covariationCalculator2.GetFirstValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSecondValueMean(), covariationCalculator2.GetSecondValueMean(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetCovariation(), covariationCalculator2.GetCovariation(), eps);
- UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSumWeights(), covariationCalculator2.GetSumWeights(), eps);
- }
+ const double eps = 1e-10;
+
+ const size_t argumentsCount = 100;
+ for (size_t i = 0; i < argumentsCount; ++i) {
+ arguments.push_back(i);
+ weights.push_back(i);
+ }
+
+ TDeviationCalculator deviationCalculator1, deviationCalculator2;
+ TMeanCalculator meanCalculator1, meanCalculator2;
+ TCovariationCalculator covariationCalculator1, covariationCalculator2;
+ for (size_t i = 0; i < arguments.size(); ++i) {
+ meanCalculator1.Add(arguments[i], weights[i]);
+ meanCalculator2.Add(arguments[i], weights[i]);
+ deviationCalculator1.Add(arguments[i], weights[i]);
+ deviationCalculator2.Add(arguments[i], weights[i]);
+ covariationCalculator1.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
+ covariationCalculator2.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
+ }
+
+ UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetMean(), meanCalculator2.GetMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetSumWeights(), meanCalculator2.GetSumWeights(), eps);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetMean(), deviationCalculator2.GetMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetDeviation(), deviationCalculator2.GetDeviation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetStdDev(), deviationCalculator2.GetStdDev(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetSumWeights(), deviationCalculator2.GetSumWeights(), eps);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetFirstValueMean(), covariationCalculator2.GetFirstValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSecondValueMean(), covariationCalculator2.GetSecondValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetCovariation(), covariationCalculator2.GetCovariation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSumWeights(), covariationCalculator2.GetSumWeights(), eps);
+
+ meanCalculator2.Reset();
+ deviationCalculator2.Reset();
+ covariationCalculator2.Reset();
+
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, meanCalculator2.GetMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, meanCalculator2.GetSumWeights(), eps);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetDeviation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetStdDev(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, deviationCalculator2.GetSumWeights(), eps);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetFirstValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetSecondValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetCovariation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(0.0, covariationCalculator2.GetSumWeights(), eps);
+
+ for (size_t i = 0; i < arguments.size(); ++i) {
+ meanCalculator2.Add(arguments[i], weights[i]);
+ deviationCalculator2.Add(arguments[i], weights[i]);
+ covariationCalculator2.Add(arguments[i], arguments[arguments.size() - i - 1], weights[i]);
+ }
+
+ UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetMean(), meanCalculator2.GetMean(), 1e-10);
+ UNIT_ASSERT_DOUBLES_EQUAL(meanCalculator1.GetSumWeights(), meanCalculator2.GetSumWeights(), 1e-10);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetMean(), deviationCalculator2.GetMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetDeviation(), deviationCalculator2.GetDeviation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetStdDev(), deviationCalculator2.GetStdDev(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(deviationCalculator1.GetSumWeights(), deviationCalculator2.GetSumWeights(), eps);
+
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetFirstValueMean(), covariationCalculator2.GetFirstValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSecondValueMean(), covariationCalculator2.GetSecondValueMean(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetCovariation(), covariationCalculator2.GetCovariation(), eps);
+ UNIT_ASSERT_DOUBLES_EQUAL(covariationCalculator1.GetSumWeights(), covariationCalculator2.GetSumWeights(), eps);
+ }
}
diff --git a/library/cpp/linear_regression/welford.cpp b/library/cpp/linear_regression/welford.cpp
index 509e80e970..e27b1994f6 100644
--- a/library/cpp/linear_regression/welford.cpp
+++ b/library/cpp/linear_regression/welford.cpp
@@ -1,5 +1,5 @@
#include "welford.h"
-
+
#include <util/generic/ymath.h>
void TMeanCalculator::Multiply(const double value) {
@@ -28,10 +28,10 @@ double TMeanCalculator::GetSumWeights() const {
return SumWeights.Get();
}
-void TMeanCalculator::Reset() {
- *this = TMeanCalculator();
-}
-
+void TMeanCalculator::Reset() {
+ *this = TMeanCalculator();
+}
+
void TCovariationCalculator::Add(const double firstValue, const double secondValue, const double weight /*= 1.*/) {
SumWeights += weight;
if (SumWeights.Get()) {
@@ -66,10 +66,10 @@ double TCovariationCalculator::GetSumWeights() const {
return SumWeights.Get();
}
-void TCovariationCalculator::Reset() {
- *this = TCovariationCalculator();
-}
-
+void TCovariationCalculator::Reset() {
+ *this = TCovariationCalculator();
+}
+
void TDeviationCalculator::Add(const double value, const double weight /*= 1.*/) {
const double lastMean = MeanCalculator.GetMean();
MeanCalculator.Add(value, weight);
@@ -101,7 +101,7 @@ double TDeviationCalculator::GetStdDev() const {
double TDeviationCalculator::GetSumWeights() const {
return MeanCalculator.GetSumWeights();
}
-
-void TDeviationCalculator::Reset() {
- *this = TDeviationCalculator();
-}
+
+void TDeviationCalculator::Reset() {
+ *this = TDeviationCalculator();
+}
diff --git a/library/cpp/linear_regression/welford.h b/library/cpp/linear_regression/welford.h
index 0706ac2cfa..ee865d6693 100644
--- a/library/cpp/linear_regression/welford.h
+++ b/library/cpp/linear_regression/welford.h
@@ -18,7 +18,7 @@ public:
void Remove(const double value, const double weight = 1.);
double GetMean() const;
double GetSumWeights() const;
- void Reset();
+ void Reset();
bool operator<(const TMeanCalculator& other) const {
return Mean < other.Mean;
@@ -51,8 +51,8 @@ public:
double GetCovariation() const;
double GetSumWeights() const;
-
- void Reset();
+
+ void Reset();
};
// accurately computes (w_1 * x_1 * x_1 + w_2 * x_2 * x_2 + ... + w_n * x_n * x_n) / (w_1 + w_2 + ... + w_n)
@@ -72,6 +72,6 @@ public:
double GetStdDev() const;
double GetSumWeights() const;
-
- void Reset();
+
+ void Reset();
};
diff --git a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
index f5b8a8e50c..0d4d79d483 100644
--- a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
@@ -14,17 +14,17 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
NSc::TValue v;
UNIT_ASSERT(!v.PathExists(path));
UNIT_ASSERT(NSc::TValue::PathValid(path));
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelect(path), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelect(path), NSc::Null()));
*v.TrySelectOrAdd(path) = 1;
NSc::NUt::AssertSchemeJson(expected, v);
UNIT_ASSERT(v.PathExists(path));
UNIT_ASSERT(1 == v.TrySelectOrAdd(path)->GetNumber());
UNIT_ASSERT(1 == v.TrySelect(path).GetNumber());
UNIT_ASSERT(1 == v.TrySelectAndDelete(path).GetNumber());
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete(path), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete(path), NSc::Null()));
NSc::NUt::AssertSchemeJson(delexpected, v);
UNIT_ASSERT(!v.PathExists(path));
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelect(path), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelect(path), NSc::Null()));
}
Y_UNIT_TEST(TestSelect) {
@@ -35,19 +35,19 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("null", v);
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("null", v);
v.SetDict();
UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("{}", v);
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("{}", v);
v.SetArray();
UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("[]", v);
- UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("[]", v);
DoTestSelect("[]", "{'':1}", "{}");
diff --git a/library/cpp/scheme/tests/ut/scheme_ut.cpp b/library/cpp/scheme/tests/ut/scheme_ut.cpp
index 1e9afb124f..1a5d07c31b 100644
--- a/library/cpp/scheme/tests/ut/scheme_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_ut.cpp
@@ -372,8 +372,8 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
Y_UNIT_TEST(TestFrontBack) {
NSc::TValue v;
const NSc::TValue& vv = v;
- UNIT_ASSERT(NSc::TValue::Same(vv.Front(), NSc::Null()));
- UNIT_ASSERT(NSc::TValue::Same(vv.Back(), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(vv.Front(), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(vv.Back(), NSc::Null()));
UNIT_ASSERT(!vv.IsArray());
v.Back() = "a";
UNIT_ASSERT_VALUES_EQUAL("a", vv.Front().GetString());
@@ -390,8 +390,8 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
UNIT_ASSERT_VALUES_EQUAL("a", v.Pop().GetString());
- UNIT_ASSERT(NSc::TValue::Same(vv.Front(), NSc::Null()));
- UNIT_ASSERT(NSc::TValue::Same(vv.Back(), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(vv.Front(), NSc::Null()));
+ UNIT_ASSERT(NSc::TValue::Same(vv.Back(), NSc::Null()));
v.Front() = "a";
UNIT_ASSERT_VALUES_EQUAL("a", vv.Front().GetString());
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h
index 5687d83429..44517a0092 100644
--- a/library/cpp/testing/unittest/registar.h
+++ b/library/cpp/testing/unittest/registar.h
@@ -547,7 +547,7 @@ public: \
} \
UNIT_ASSERT_C(0, "Exception hasn't been thrown, but it should have happened " << C); \
} while (false)
-
+
#define UNIT_CHECK_GENERATED_EXCEPTION(A, E) UNIT_CHECK_GENERATED_EXCEPTION_C(A, E, "")
#define UNIT_CHECK_GENERATED_NO_EXCEPTION_C(A, E, C) \
@@ -560,7 +560,7 @@ public: \
UNIT_ASSERT_C(0, "Exception has been thrown, but it shouldn't have happened " << C); \
} \
} while (false)
-
+
#define UNIT_CHECK_GENERATED_NO_EXCEPTION(A, E) UNIT_CHECK_GENERATED_NO_EXCEPTION_C(A, E, "and exception message is:\n" << CurrentExceptionMessage())
// Same as UNIT_ASSERT_EXCEPTION_SATISFIES but prints additional string C when nothing was thrown
diff --git a/library/cpp/testing/unittest/ut/main.cpp b/library/cpp/testing/unittest/ut/main.cpp
index 41000890eb..e303e21e30 100644
--- a/library/cpp/testing/unittest/ut/main.cpp
+++ b/library/cpp/testing/unittest/ut/main.cpp
@@ -55,11 +55,11 @@ namespace {
TEST_F(TFixture, Test1) {
ASSERT_EQ(I, 5);
}
-
-TEST(ETest, Test1) {
- UNIT_CHECK_GENERATED_EXCEPTION(ythrow yexception(), yexception);
- UNIT_CHECK_GENERATED_NO_EXCEPTION(true, yexception);
-}
+
+TEST(ETest, Test1) {
+ UNIT_CHECK_GENERATED_EXCEPTION(ythrow yexception(), yexception);
+ UNIT_CHECK_GENERATED_NO_EXCEPTION(true, yexception);
+}
Y_UNIT_TEST_SUITE(TestSingleTestFixture)
{
diff --git a/library/cpp/threading/skip_list/perf/main.cpp b/library/cpp/threading/skip_list/perf/main.cpp
index bc6982d7c2..4ad52049e7 100644
--- a/library/cpp/threading/skip_list/perf/main.cpp
+++ b/library/cpp/threading/skip_list/perf/main.cpp
@@ -1,7 +1,7 @@
#include <library/cpp/threading/skip_list/skiplist.h>
#include <library/cpp/getopt/small/last_getopt.h>
-
+
#include <library/cpp/charset/ci_string.h>
#include <util/datetime/base.h>
#include <util/generic/map.h>