|
Cambridge SMT System
|
Unit testing: multithreading with a threadpool. More...
#include <googletesting.h>#include "main.custom_assert.hpp"#include "main.logger.hpp"#include "multithreading.hpp"
Go to the source code of this file.
Classes | |
| struct | googletesting::functor_test |
| struct | googletesting::functor_test2 |
Namespaces | |
| googletesting | |
| test-specific classes and functions | |
Functions | |
| TEST (multithreading, threadpool1) | |
| TEST (multithreading, threadpool2) | |
| int | main (int argc, char **argv) |
| main function. If compiled individualy, will kickoff any tests in this file. More... | |
Variables | |
| bool | user_check_ok |
Unit testing: multithreading with a threadpool.
Definition in file multithreading.gtest.cpp.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
main function. If compiled individualy, will kickoff any tests in this file.
Definition at line 113 of file multithreading.gtest.cpp.
| TEST | ( | multithreading | , |
| threadpool1 | |||
| ) |
This test shows that functors are actually being passed by value to the threadpool, not per reference. First time i use these cool asio libraries, so I might be missing something here, but it initially looks like a limitation of asio::ioservice::post method (cannot pass by reference)
Definition at line 59 of file multithreading.gtest.cpp.
| TEST | ( | multithreading | , |
| threadpool2 | |||
| ) |
This test should actually work well. Passing these functors by value will bit-copy the pointer addresses, and pointees will be modified.
Safe to test
This should stop execution:
Definition at line 76 of file multithreading.gtest.cpp.
| bool user_check_ok |