aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp
blob: 79c7a14b5e4dc7a38ab3b1d480df677a5d6e5818 (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); 
    } 
}