thread_helper_ut.cpp 571 B

1234567891011121314151617181920212223242526
  1. #include "thread_helper.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. #include <util/generic/string.h>
  4. #include <util/generic/yexception.h>
  5. Y_UNIT_TEST_SUITE(TestMP) {
  6. Y_UNIT_TEST(TestErr) {
  7. std::function<void(int)> f = [](int x) {
  8. if (x == 5) {
  9. ythrow yexception() << "oops";
  10. }
  11. };
  12. TString s;
  13. try {
  14. NYmp::ParallelForStaticAutoChunk(0, 10, f);
  15. } catch (...) {
  16. s = CurrentExceptionMessage();
  17. }
  18. UNIT_ASSERT(s.find("oops") > 0);
  19. }
  20. }