forked from bblanchon/ArduinoJson
Remove memoryUsage()
This commit is contained in:
1 parent
2fdacb1ca0
commit
00c9d8680a
43 files changed
+1173
-567
No files matched your search
@@ -6,10 +6,13 @@
|
||||
#include <stdint.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Allocators.hpp"
|
||||
|
||||
using ArduinoJson::detail::sizeofString;
|
||||
|
||||
TEST_CASE("JsonVariant::clear()") {
|
||||
JsonDocument doc;
|
||||
SpyingAllocator allocator;
|
||||
JsonDocument doc(&allocator);
|
||||
JsonVariant var = doc.to<JsonVariant>();
|
||||
|
||||
SECTION("size goes back to zero") {
|
||||
@@ -28,9 +31,10 @@ TEST_CASE("JsonVariant::clear()") {
|
||||
|
||||
SECTION("releases owned string") {
|
||||
var.set(std::string("hello"));
|
||||
REQUIRE(doc.memoryUsage() == sizeofString(5));
|
||||
|
||||
var.clear();
|
||||
REQUIRE(doc.memoryUsage() == 0);
|
||||
|
||||
REQUIRE(allocator.log() ==
|
||||
AllocatorLog() << AllocatorLog::Allocate(sizeofString(5))
|
||||
<< AllocatorLog::Deallocate(sizeofString(5)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user