From b3132cac3a69707685ac0b5ae88222a6ed412908 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Fri, 7 Apr 2023 18:29:54 +0200 Subject: [PATCH] Tests: add SpyingAllocator::clearLog() --- extras/tests/Helpers/Allocators.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/tests/Helpers/Allocators.hpp b/extras/tests/Helpers/Allocators.hpp index ab4bbea1..ba648794 100644 --- a/extras/tests/Helpers/Allocators.hpp +++ b/extras/tests/Helpers/Allocators.hpp @@ -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; }