aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/future/legacy_future_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/threading/future/legacy_future_ut.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/legacy_future_ut.cpp')
-rw-r--r--library/cpp/threading/future/legacy_future_ut.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/library/cpp/threading/future/legacy_future_ut.cpp b/library/cpp/threading/future/legacy_future_ut.cpp
index 96b46ccebf..ff63db1725 100644
--- a/library/cpp/threading/future/legacy_future_ut.cpp
+++ b/library/cpp/threading/future/legacy_future_ut.cpp
@@ -4,69 +4,69 @@
namespace NThreading {
Y_UNIT_TEST_SUITE(TLegacyFutureTest) {
- int intf() {
- return 17;
- }
+ int intf() {
+ return 17;
+ }
Y_UNIT_TEST(TestIntFunction) {
- TLegacyFuture<int> f((&intf));
- UNIT_ASSERT_VALUES_EQUAL(17, f.Get());
- }
+ TLegacyFuture<int> f((&intf));
+ UNIT_ASSERT_VALUES_EQUAL(17, f.Get());
+ }
- static int r;
+ static int r;
- void voidf() {
- r = 18;
- }
+ void voidf() {
+ r = 18;
+ }
Y_UNIT_TEST(TestVoidFunction) {
- r = 0;
- TLegacyFuture<> f((&voidf));
- f.Get();
- UNIT_ASSERT_VALUES_EQUAL(18, r);
- }
+ r = 0;
+ TLegacyFuture<> f((&voidf));
+ f.Get();
+ UNIT_ASSERT_VALUES_EQUAL(18, r);
+ }
- struct TSampleClass {
- int mValue;
+ struct TSampleClass {
+ int mValue;
- TSampleClass(int value)
- : mValue(value)
- {
- }
+ TSampleClass(int value)
+ : mValue(value)
+ {
+ }
- int Calc() {
- return mValue + 1;
- }
- };
+ int Calc() {
+ return mValue + 1;
+ }
+ };
Y_UNIT_TEST(TestMethod) {
- TLegacyFuture<int> f11(std::bind(&TSampleClass::Calc, TSampleClass(3)));
- UNIT_ASSERT_VALUES_EQUAL(4, f11.Get());
+ TLegacyFuture<int> f11(std::bind(&TSampleClass::Calc, TSampleClass(3)));
+ UNIT_ASSERT_VALUES_EQUAL(4, f11.Get());
TLegacyFuture<int> f12(std::bind(&TSampleClass::Calc, TSampleClass(3)), SystemThreadFactory());
- UNIT_ASSERT_VALUES_EQUAL(4, f12.Get());
+ UNIT_ASSERT_VALUES_EQUAL(4, f12.Get());
- TSampleClass c(5);
+ TSampleClass c(5);
- TLegacyFuture<int> f21(std::bind(&TSampleClass::Calc, std::ref(c)));
- UNIT_ASSERT_VALUES_EQUAL(6, f21.Get());
+ TLegacyFuture<int> f21(std::bind(&TSampleClass::Calc, std::ref(c)));
+ UNIT_ASSERT_VALUES_EQUAL(6, f21.Get());
TLegacyFuture<int> f22(std::bind(&TSampleClass::Calc, std::ref(c)), SystemThreadFactory());
- UNIT_ASSERT_VALUES_EQUAL(6, f22.Get());
- }
+ UNIT_ASSERT_VALUES_EQUAL(6, f22.Get());
+ }
struct TSomeThreadPool: public IThreadFactory {};
Y_UNIT_TEST(TestFunction) {
- std::function<int()> f((&intf));
+ std::function<int()> f((&intf));
- UNIT_ASSERT_VALUES_EQUAL(17, TLegacyFuture<int>(f).Get());
+ UNIT_ASSERT_VALUES_EQUAL(17, TLegacyFuture<int>(f).Get());
UNIT_ASSERT_VALUES_EQUAL(17, TLegacyFuture<int>(f, SystemThreadFactory()).Get());
- if (false) {
- TSomeThreadPool* q = nullptr;
- TLegacyFuture<int>(f, q); // just check compiles, do not start
- }
+ if (false) {
+ TSomeThreadPool* q = nullptr;
+ TLegacyFuture<int>(f, q); // just check compiles, do not start
+ }
}
}