Add test helper macros. (#465)
- Refactor the existing SNMALLOC_ASSERT and SNMALLOC_CHECK. These now use the FatalErrorBuilder to format the output if a format string is provided. - Extend the FatalErrorBuilder to print decimal integers for signed values. - Rename FatalErrorBuilder to MessageBuilder. - Rewrite the macros used in the jemalloc tests to use FatalErrorBuilder and move them into a header. - Refactor some of the tests to use the new macros.
This commit is contained in:
@@ -161,10 +161,10 @@ namespace snmalloc
|
||||
*
|
||||
* These types should be sufficient for allocator-related error messages.
|
||||
*/
|
||||
template<size_t BufferSize = 1024, typename... Args>
|
||||
template<size_t BufferSize, typename... Args>
|
||||
[[noreturn]] inline void report_fatal_error(Args... args)
|
||||
{
|
||||
FatalErrorBuilder<BufferSize> msg{std::forward<Args>(args)...};
|
||||
MessageBuilder<BufferSize> msg{std::forward<Args>(args)...};
|
||||
Pal::error(msg.get_message());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user