|
Hegel 0.13.1
Property-based testing for C++
|
A pool of values that concurrent workers can share. More...
#include <stateful.h>
Public Member Functions | |
| ConcurrentPool (const TestCase &tc) | |
| Creates an empty pool. | |
| void | add (const TestCase &tc, T value) |
| Adds a value to the pool. | |
| bool | empty () const |
| Returns true if the pool contains no values. | |
| std::size_t | size () const |
| Returns the number of values in the pool. | |
| ConcurrentPool (const ConcurrentPool &)=delete | |
| ConcurrentPool & | operator= (const ConcurrentPool &)=delete |
Friends | |
| class | ConcurrentVariablesGenerator< T > |
A pool of values that concurrent workers can share.
Store the pool in a concurrent state machine. Use add to add a value from a worker, values_reusable to draw a copy without removal, and values_consumed to draw and remove a value.
libhegel selects a value and updates the pool as an atomic operation. A draw rejects the test case if the pool is empty.
A ConcurrentPool is not copyable.
| T | The type of the values in the pool |
|
inlineexplicit |
Creates an empty pool.
| tc | The test case |
|
inline |
Adds a value to the pool.
Call with the test case of the current worker.
| tc | The test case of the current worker |
| value | The value to add |
|
inline |
Returns true if the pool contains no values.
|
inline |
Returns the number of values in the pool.