Tests: add SpyingAllocator::clearLog()

This commit is contained in:
Benoit Blanchon
2023-04-07 18:29:54 +02:00
parent d95a3bd19a
commit b3132cac3a

View File

@ -120,6 +120,7 @@ class SpyingAllocator : public ArduinoJson::Allocator {
_upstream->reallocate(block, sizeof(AllocatedBlock) + n - 1));
if (block) {
_log << AllocatorLog::Reallocate(oldSize, n);
ARDUINOJSON_ASSERT(block->size == oldSize);
block->size = n;
return block->payload;
} else {
@ -128,6 +129,10 @@ class SpyingAllocator : public ArduinoJson::Allocator {
}
}
void clearLog() {
_log = AllocatorLog();
}
const AllocatorLog& log() const {
return _log;
}