aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp
blob: 74176368643bdbccfa1d8162cbc489e77f29a23b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "thread_helper.h"

#include <library/cpp/testing/unittest/registar.h>

#include <util/generic/string.h>
#include <util/generic/yexception.h>

Y_UNIT_TEST_SUITE(TestMP) {
    Y_UNIT_TEST(TestErr) {
        std::function<void(int)> f = [](int x) {
            if (x == 5) {
                ythrow yexception() << "oops";
            }
        };

        TString s;

        try {
            NYmp::ParallelForStaticAutoChunk(0, 10, f);
        } catch (...) {
            s = CurrentExceptionMessage();
        }

        UNIT_ASSERT(s.find("oops") > 0);
    }
}