| 142 | |
| 143 | Y_UNIT_TEST_SUITE(TFutureMultiThreadedTest) { |
| 144 | Y_UNIT_TEST(WaitAll) { |
| 145 | RunWaitTest( |
| 146 | [](auto snapshotter) { |
| 147 | return [=]() { |
| 148 | auto* futures = snapshotter().Futures; |
| 149 | |
| 150 | auto all = WaitNoOpt<TWaitPolicy::TAll>(*futures); |
| 151 | |
| 152 | // tests safety part |
| 153 | all.Subscribe([=] (auto&& all) { |
| 154 | TStateSnapshot snap = snapshotter(); |
| 155 | |
| 156 | // value safety: all is set => every future is set |
| 157 | UNIT_ASSERT(all.HasValue() <= ((snap.Started == (i64)snap.Futures->size()) && !snap.StartedException)); |
| 158 | |
| 159 | // safety for hasException: all is set => every future is set and some has exception |
| 160 | UNIT_ASSERT(all.HasException() <= ((snap.Started == (i64)snap.Futures->size()) && snap.StartedException > 0)); |
| 161 | }); |
| 162 | |
| 163 | // test liveness |
| 164 | all.Wait(); |
| 165 | }; |
| 166 | }); |
| 167 | } |
| 168 | |
| 169 | Y_UNIT_TEST(WaitAny) { |
| 170 | RunWaitTest( |
nothing calls this directly
no test coverage detected