Skip to content

Commit b3132ca

Browse files
committed
Tests: add SpyingAllocator::clearLog()
1 parent d95a3bd commit b3132ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

extras/tests/Helpers/Allocators.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class SpyingAllocator : public ArduinoJson::Allocator {
120120
_upstream->reallocate(block, sizeof(AllocatedBlock) + n - 1));
121121
if (block) {
122122
_log << AllocatorLog::Reallocate(oldSize, n);
123+
ARDUINOJSON_ASSERT(block->size == oldSize);
123124
block->size = n;
124125
return block->payload;
125126
} else {
@@ -128,6 +129,10 @@ class SpyingAllocator : public ArduinoJson::Allocator {
128129
}
129130
}
130131

132+
void clearLog() {
133+
_log = AllocatorLog();
134+
}
135+
131136
const AllocatorLog& log() const {
132137
return _log;
133138
}

0 commit comments

Comments
 (0)