Files
ArduinoJson/test/DynamicJsonBuffer/size.cpp

28 lines
554 B
C++
Raw Normal View History

// ArduinoJson - arduinojson.org
2018-01-05 09:20:01 +01:00
// Copyright Benoit Blanchon 2014-2018
2017-06-17 16:48:40 +02:00
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
TEST_CASE("DynamicJsonBuffer::size()") {
DynamicJsonBuffer buffer;
SECTION("Initial size is 0") {
REQUIRE(0 == buffer.size());
}
SECTION("Increases after alloc()") {
buffer.alloc(1);
REQUIRE(1U <= buffer.size());
buffer.alloc(1);
REQUIRE(2U <= buffer.size());
}
SECTION("Goes back to 0 after clear()") {
buffer.alloc(1);
buffer.clear();
REQUIRE(0 == buffer.size());
}
}