more mocks

This commit is contained in:
Denis Blank 2017-10-04 04:52:30 +02:00
parent b67ca1c224
commit 75b5ecad9d
2 changed files with 43 additions and 13 deletions

View File

@ -48,7 +48,7 @@ namespace cti {
/// | `continuable_base with <Arg>` | `std::future<Arg>` |
/// | `continuable_base with <Args...>` | `std::future<std::tuple<Args...>>` |
///
/// \alert If exceptions are used, exceptions that are thrown are forwarded
/// \alert If exceptions are used, exceptions that are thrown, are forwarded
/// to the returned future. If there are no exceptions supported,
/// you shall not pass any errors to the end of the asynchronous
/// call chain!

View File

@ -25,22 +25,48 @@
#include <string>
#include <system_error>
template <typename... A> struct continuable {
template <typename T = int> continuable(T&& = 0) {}
template <typename... A>
struct continuable {
template <typename T = int>
continuable(T&& = 0) {
}
template <typename T> continuable& then(T&&) { return *this; }
template <typename T>
continuable& then(T&&) {
return *this;
}
template <typename T> continuable& dropped(T&&) { return *this; }
template <typename T>
continuable& dropped(T&&) {
return *this;
}
template <typename T> continuable& thrown(T&&) { return *this; }
template <typename T>
continuable& thrown(T&&) {
return *this;
}
template <typename T> continuable& failed(T&&) { return *this; }
template <typename T>
continuable& failed(T&&) {
return *this;
}
template <typename T>
continuable& operator|(T&&) {
return *this;
}
};
template <typename... A> struct promise {
void set_value(A...) noexcept {}
template <typename... Args>
using channel = continuable<Args...>;
void operator()(A...) && noexcept {}
template <typename... A>
struct promise {
void set_value(A...) noexcept {
}
void operator()(A...) && noexcept {
}
void set_exception(std::exception_ptr exception) noexcept {
// ...
@ -52,12 +78,16 @@ template <typename... A> struct promise {
(void)error;
}
void cancel() noexcept {}
void cancel() noexcept {
}
bool is_canceled() const noexcept { return false; }
bool is_canceled() const noexcept {
return false;
}
};
template <typename... Result> struct accumulator {
template <typename... Result>
struct accumulator {
auto accumulate() {
return [] {};
}