Versions of gtest macros that run tests in a coroutine environment and other helpers.
There are the following extensions:
- _MT ("multi-threaded") macro versions take 'thread_count' integer as the 3rd parameter at the test definition. It specifies the number of worker threads that should be created for the test. By default, there is only 1 worker thread, which should be enough for most tests;
- The current thread count is available via engine::current_task::GetWorkerCount().
Usage examples:
UTEST(Semaphore, PassAcrossCoroutines) {
std::shared_lock guard{s};
auto task =
utils::Async(
"test", [guard = std::move(guard)] {});
EXPECT_TRUE(task.IsFinished());
}
UTEST_MT(SemaphoreLock, LockMoveCopyOwning, 2) {
ASSERT_TRUE(lock.OwnsLock());
EXPECT_FALSE(lock.OwnsLock());
EXPECT_TRUE(move_here.OwnsLock());
}
See Unit Tests and Benchmarks for more usage examples and descriptions
|
| #define | UTEST(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST that starts the test body as a coroutine task.
|
| #define | UTEST_DEATH(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST for death tests that starts the test body as a coroutine task.
|
| #define | UTEST_MT(test_suite_name, test_name, thread_count) |
| | An equivalent of the gtest macro TEST that starts the test body as a coroutine task.
|
| #define | UTEST_F(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST_F that starts the test body as a coroutine task.
|
| #define | UTEST_F_DEATH(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST_F for death tests that starts the test body as a coroutine task.
|
| #define | UTEST_F_MT(test_suite_name, test_name, thread_count) |
| | An equivalent of the gtest macro TEST_F that starts the test body as a coroutine task.
|
| #define | UTEST_P(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST_P that starts the test body as a coroutine task.
|
| #define | UTEST_P_DEATH(test_suite_name, test_name) |
| | An equivalent of the gtest macro TEST_P for death tests that starts the test body as a coroutine task.
|
| #define | UTEST_P_MT(test_suite_name, test_name, thread_count) |
| | An equivalent of the gtest macro TEST_P that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST(test_suite_name, test_name) |
| | An equivalent of the gtest macro TYPED_TEST that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST_MT(test_suite_name, test_name, thread_count) |
| | An equivalent of the gtest macro TYPED_TEST that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST_P(test_suite_name, test_name) |
| | An equivalent of the gtest macro TYPED_TEST_P that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST_P_MT(test_suite_name, test_name, thread_count) |
| | An equivalent of the gtest macro TYPED_TEST_P that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST_SUITE(test_suite_name, types) |
| | An equivalent of the gtest macro TYPED_TEST_SUITE that starts the test body as a coroutine task.
|
| #define | INSTANTIATE_UTEST_SUITE_P(prefix, test_suite_name, ...) |
| | An equivalent of the gtest macro INSTANTIATE_TEST_SUITE_P that starts the test body as a coroutine task.
|
| #define | REGISTER_TYPED_UTEST_SUITE_P(test_suite_name, ...) |
| | An equivalent of the gtest macro REGISTER_TYPED_TEST_SUITE_P that starts the test body as a coroutine task.
|
| #define | INSTANTIATE_TYPED_UTEST_SUITE_P(prefix, test_suite_name, types) |
| | An equivalent of the gtest macro INSTANTIATE_TYPED_TEST_SUITE_P that starts the test body as a coroutine task.
|
| #define | TYPED_UTEST_SUITE_P(test_suite_name) |
| | An equivalent of the gtest macro TYPED_TEST_SUITE_P that starts the test body as a coroutine task.
|
| #define | UEXPECT_THROW_MSG(statement, exception_type, message_substring) |
| #define | UASSERT_THROW_MSG(statement, exception_type, message_substring) |
| #define | UEXPECT_THROW(statement, exception_type) |
| #define | UASSERT_THROW(statement, exception_type) |
| #define | UEXPECT_NO_THROW(statement) |
| #define | UASSERT_NO_THROW(statement) |
| #define | EXPECT_UINVARIANT_FAILURE(statement) |
| #define | UEXPECT_DEATH(statement, regex_or_matcher) |
| | An optimized equivalent of EXPECT_DEATH.
|
| #define | UEXPECT_DEBUG_DEATH(statement, regex_or_matcher) |
| | An optimized equivalent of EXPECT_DEBUG_DEATH.
|