Testing module

provides macro shortcuts for testing asynchronous continuations through GTest.

Contents

Defines

#define ASSERT_ASYNC_COMPLETION(CONTINUABLE)
Asserts that the final callback of the given continuable was called with any result.
#define ASSERT_ASYNC_EXCEPTION_COMPLETION(CONTINUABLE)
Asserts that the final callback of the given continuable was called with any exceptional result.
#define ASSERT_ASYNC_CANCELLATION(CONTINUABLE)
Asserts that the final callback of the given continuable is called with a cancelled result which is represented by a default constructed exception_t.
#define ASSERT_ASYNC_INCOMPLETION(CONTINUABLE)
Asserts that the final callback of the given continuable is never called with any result.
#define ASSERT_ASYNC_VALIDATION(CONTINUABLE, VALIDATOR)
Expects the continuation to be called and forwards it's arguments to the given validator which can then do assertions on the result.
#define ASSERT_ASYNC_BINARY_VALIDATION(VALIDATOR, ...)
Asserts that the continuation was called and forwards it's arguments to the given validator which can then do assertions on the result.
#define ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION(VALIDATOR, ...)
Asserts that the continuation was resolved through an error and forwards it's error result to the given validator which can then do assertions on the error result.
#define EXPECT_ASYNC_RESULT(...)
Expects that the continuable is finished with the given result.
#define EXPECT_ASYNC_EXCEPTION_RESULT(...)
Asserts that the continuable is finished with the given exception.
#define ASSERT_ASYNC_RESULT(...)
Asserts that the continuable is finished with the given result.
#define ASSERT_ASYNC_TYPES(CONTINUABLE, ...)
Asserts that the continuable is finished with the given type of arguments without validating it against equality.
#define ASSERT_ASYNC_EXCEPTION_RESULT(...)
Asserts that the continuable is finished with the given exception.

Define documentation

#define ASSERT_ASYNC_COMPLETION(CONTINUABLE)

Asserts that the final callback of the given continuable was called with any result.

#define ASSERT_ASYNC_EXCEPTION_COMPLETION(CONTINUABLE)

Asserts that the final callback of the given continuable was called with any exceptional result.

#define ASSERT_ASYNC_CANCELLATION(CONTINUABLE)

Asserts that the final callback of the given continuable is called with a cancelled result which is represented by a default constructed exception_t.

#define ASSERT_ASYNC_INCOMPLETION(CONTINUABLE)

Asserts that the final callback of the given continuable is never called with any result.

#define ASSERT_ASYNC_BINARY_VALIDATION(VALIDATOR, ...)

Asserts that the continuation was called and forwards it's arguments to the given validator which can then do assertions on the result.

A validator consists of a binary consumer with a signature as in in the example shown below:

auto validator = [](auto expected, auto actual) {
  EXPECT_EQ(expected, actual);
};

The macro is usable as shown in the following example:

continuable<string> async_get(std::string);
// ...
auto validator = [](auto expected, auto actual) {
  EXPECT_EQ(expected, actual);
};

ASSERT_ASYNC_BINARY_VALIDATION(validator, async_get("hello"), "hello")

The validator is called for every expecting and actual result.

#define ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION(VALIDATOR, ...)

Asserts that the continuation was resolved through an error and forwards it's error result to the given validator which can then do assertions on the error result.

#define EXPECT_ASYNC_RESULT(...)

Expects that the continuable is finished with the given result.

continuable<string> async_get(std::string);
// ...

EXPECT_ASYNC_RESULT(async_get("hello"), "hello");

#define EXPECT_ASYNC_EXCEPTION_RESULT(...)

Asserts that the continuable is finished with the given exception.

#define ASSERT_ASYNC_RESULT(...)

Asserts that the continuable is finished with the given result.

continuable<string> async_get(std::string);
// ...

ASSERT_ASYNC_RESULT(async_get("hello"), "hello");

#define ASSERT_ASYNC_TYPES(CONTINUABLE, ...)

Asserts that the continuable is finished with the given type of arguments without validating it against equality.

continuable<string> async_get(std::string);
// ...

ASSERT_ASYNC_TYPES(async_get("hello"), std::string);

#define ASSERT_ASYNC_EXCEPTION_RESULT(...)

Asserts that the continuable is finished with the given exception.