summaryrefslogtreecommitdiffstats
path: root/libcxx/test/thread/futures/futures.future_error/code.pass.cpp
blob: 9b7407ae95b1571b68f5d7909ed0c59cb1b4528b (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <future>

// class future_error

// const error_code& code() const throw();

#include <future>
#include <cassert>

int main()
{
    {
        std::error_code ec = std::make_error_code(std::future_errc::broken_promise);
        std::future_error f(ec);
        assert(f.code() == ec);
    }
    {
        std::error_code ec = std::make_error_code(std::future_errc::future_already_retrieved);
        std::future_error f(ec);
        assert(f.code() == ec);
    }
    {
        std::error_code ec = std::make_error_code(std::future_errc::promise_already_satisfied);
        std::future_error f(ec);
        assert(f.code() == ec);
    }
    {
        std::error_code ec = std::make_error_code(std::future_errc::no_state);
        std::future_error f(ec);
        assert(f.code() == ec);
    }
}
OpenPOWER on IntegriCloud