minix/external/bsd/libc++/dist/libcxx/test/thread/futures/futures.future_error/what.pass.cpp
Lionel Sambuc 4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00

41 lines
1.4 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <future>
// class future_error
// const char* what() const throw();
#include <future>
#include <cstring>
#include <cassert>
int main()
{
{
std::future_error f(std::make_error_code(std::future_errc::broken_promise));
assert(std::strcmp(f.what(), "The associated promise has been destructed prior "
"to the associated state becoming ready.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved));
assert(std::strcmp(f.what(), "The future has already been retrieved from "
"the promise or packaged_task.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied));
assert(std::strcmp(f.what(), "The state of the promise has already been set.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::no_state));
assert(std::strcmp(f.what(), "Operation not permitted on an object without "
"an associated state.") == 0);
}
}