mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-24 15:57:30 +02:00
Tests: make allocator assertions more readable
This commit is contained in:
@ -31,8 +31,9 @@ TEST_CASE("ResourceManager::swap()") {
|
||||
REQUIRE(a1->data() == b.getSlot(a1.id())->data());
|
||||
REQUIRE(b1->data() == a.getSlot(b1.id())->data());
|
||||
|
||||
REQUIRE(spy.log() == AllocatorLog()
|
||||
<< AllocatorLog::Allocate(sizeofPool()) * 2);
|
||||
REQUIRE(spy.log() == AllocatorLog{
|
||||
Allocate(sizeofPool()) * 2,
|
||||
});
|
||||
}
|
||||
|
||||
SECTION("Only left using preallocated pool list") {
|
||||
@ -48,12 +49,12 @@ TEST_CASE("ResourceManager::swap()") {
|
||||
REQUIRE(a1->data() == b.getSlot(a1.id())->data());
|
||||
REQUIRE(b1->data() == a.getSlot(b1.id())->data());
|
||||
|
||||
REQUIRE(spy.log() == AllocatorLog()
|
||||
<< AllocatorLog::Allocate(sizeofPool()) *
|
||||
(ARDUINOJSON_INITIAL_POOL_COUNT + 1)
|
||||
<< AllocatorLog::Allocate(sizeofPoolList(
|
||||
ARDUINOJSON_INITIAL_POOL_COUNT * 2))
|
||||
<< AllocatorLog::Allocate(sizeofPool()));
|
||||
REQUIRE(spy.log() ==
|
||||
AllocatorLog{
|
||||
Allocate(sizeofPool()) * (ARDUINOJSON_INITIAL_POOL_COUNT + 1),
|
||||
Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)),
|
||||
Allocate(sizeofPool()),
|
||||
});
|
||||
}
|
||||
|
||||
SECTION("Only right using preallocated pool list") {
|
||||
@ -69,12 +70,12 @@ TEST_CASE("ResourceManager::swap()") {
|
||||
REQUIRE(a1->data() == b.getSlot(a1.id())->data());
|
||||
REQUIRE(b1->data() == a.getSlot(b1.id())->data());
|
||||
|
||||
REQUIRE(spy.log() == AllocatorLog()
|
||||
<< AllocatorLog::Allocate(sizeofPool()) *
|
||||
ARDUINOJSON_INITIAL_POOL_COUNT
|
||||
<< AllocatorLog::Allocate(sizeofPoolList(
|
||||
ARDUINOJSON_INITIAL_POOL_COUNT * 2))
|
||||
<< AllocatorLog::Allocate(sizeofPool()) * 2);
|
||||
REQUIRE(spy.log() ==
|
||||
AllocatorLog{
|
||||
Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT,
|
||||
Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)),
|
||||
Allocate(sizeofPool()) * 2,
|
||||
});
|
||||
}
|
||||
|
||||
SECTION("None is using preallocated pool list") {
|
||||
|
Reference in New Issue
Block a user