Fix JsonVariant::memoryUsage() for raw strings

This commit is contained in:
Benoit Blanchon
2021-11-12 16:55:41 +01:00
parent 0429016ff1
commit 599e927590
3 changed files with 7 additions and 2 deletions

View File

@ -30,10 +30,12 @@ TEST_CASE("JsonVariant::memoryUsage()") {
SECTION("returns size of owned string") {
var.set(std::string("hello"));
REQUIRE(var.memoryUsage() == 6);
REQUIRE(var.memoryUsage() == doc.memoryUsage());
}
SECTION("returns size of owned raw") {
var.set(serialized(std::string("hello")));
REQUIRE(var.memoryUsage() == 5);
REQUIRE(var.memoryUsage() == 6);
REQUIRE(var.memoryUsage() == doc.memoryUsage());
}
}