|
| template<int channel = 0> |
| Tracker_id | tracker_get_object_id () |
| | The value to use for m_id next time we construct an Allocator. More...
|
| |
| template<class Type > |
| std::string_view | type_name () |
| | Return the name of the given type (not demangled). More...
|
| |
| template<std::invocable< mysql::allocators::Memory_resource > Initializer_t, std::invocable Function_t> |
| int | oom_test (const Initializer_t &initialize, const Function_t &function) |
| | Repeatedly call function(). More...
|
| |
| template<class Object_t > |
| int | oom_test_copyable_object (const Object_t &object, std::invocable< Object_t & > auto function) |
| | Repeatedly construct copies of object and call function(copy). More...
|
| |
| template<class Object_t > |
| int | oom_test_assignable_object (const Object_t &object, std::invocable< Object_t & > auto function) |
| | Repeatedly construct copies of object and call function(copy). More...
|
| |
| void | test_eq_one_way (const auto &left, const auto &right, bool equal=true) |
| | Assert that both (left==right) and !(left!=right) have the same truth values as equal. More...
|
| |
| void | test_eq (const auto &left, const auto &right, bool equal=true) |
| | Assert that (left==right), (right==left), !(left!=right), and !(right!=left) all have the same truth values as equal. More...
|
| |
| void | test_cmp_one_way (const auto &left, const auto &right, auto cmp) |
| | For all 7 comparison operators, assert that (left OP right) == (cmp OP 0). More...
|
| |
| void | test_cmp (const auto &left, const auto &right, std::strong_ordering cmp) |
| | For all 7 comparison operators, assert that (left OP right) == (cmp OP 0), and that (right OP left) == (0 OP cmp). More...
|
| |
| void | test_cmp (const auto &left, const auto &right, int cmp) |
| | For all 7 comparison operators, assert that (left OP right) == (cmp OP 0), and that (right OP left) == (0 OP cmp). More...
|
| |
template<class Object_t >
| int mysql::debugging::oom_test_assignable_object |
( |
const Object_t & |
object, |
|
|
std::invocable< Object_t & > auto |
function |
|
) |
| |
Repeatedly construct copies of object and call function(copy).
In the Nth iteration, simulate out-of-memory error on the Nth allocation. Return as soon as it succeeds.
This is intended for use with non-throwing containers which do not have a copy constructor.
- Template Parameters
-
| Object_t | Type of the object. This must have a constructor taking a Memory_resource as parameter, and a member function assign taking another Object_t as argument. The assign member must not replace the memory resource used by the object to allocate. |
- Parameters
-
| object | Object to test. |
| function | Function to test, which should take an Object& as its only parameter. This function may use the memory_resource that was previously passed to initialize. The Nth time it calls the allocate member, allocate will fail. The function is allowed two ways to report error: (1) If it returns mysql::utils::Return_status, Return_status::ok should indicate success and Return_status::error indicate out-of-memory. Otherwise, function return should indicate success and bad_alloc exception should indicate error. |
- Returns
- The number of iterations until function(copy) succeeded. If function is deterministic, this equals the number of allocations performed by the call to function(copy).
| void mysql::debugging::test_cmp |
( |
const auto & |
left, |
|
|
const auto & |
right, |
|
|
int |
cmp |
|
) |
| |
For all 7 comparison operators, assert that (left OP right) == (cmp OP 0), and that (right OP left) == (0 OP cmp).
This overload is for when cmp is of type int.
- Parameters
-
| left | Left-hand-side operand. |
| right | Right-hand-side operand. |
| cmp | Expected outcome: -1 if left<right, 0 if left==right, and 1 if left>right. |
(Despite the parameter names, this will also test the case where left and right are swapped and cmp reversed).
| void mysql::debugging::test_eq |
( |
const auto & |
left, |
|
|
const auto & |
right, |
|
|
bool |
equal = true |
|
) |
| |
Assert that (left==right), (right==left), !(left!=right), and !(right!=left) all have the same truth values as equal.
- Parameters
-
| left | Left-hand-side operand. |
| right | Right-hand-side operand. |
| equal | If true (the default), left and right are expected to be equal; otherwise they are expected to be different. |
(Despite the parameter names, this will also test the case where left and right are swapped).