forked from bblanchon/ArduinoJson
Changed unit testing framework from Google Test to Catch
This commit is contained in:
31
test/DynamicJsonBuffer/createArray.cpp
Normal file
31
test/DynamicJsonBuffer/createArray.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://bblanchon.github.io/ArduinoJson/
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("DynamicJsonBuffer::createArray()") {
|
||||
DynamicJsonBuffer jsonBuffer;
|
||||
JsonArray &array = jsonBuffer.createArray();
|
||||
|
||||
SECTION("GrowsWithArray") {
|
||||
REQUIRE(JSON_ARRAY_SIZE(0) == jsonBuffer.size());
|
||||
|
||||
array.add("hello");
|
||||
REQUIRE(JSON_ARRAY_SIZE(1) == jsonBuffer.size());
|
||||
|
||||
array.add("world");
|
||||
REQUIRE(JSON_ARRAY_SIZE(2) == jsonBuffer.size());
|
||||
}
|
||||
|
||||
SECTION("CanAdd1000Values") {
|
||||
for (size_t i = 1; i <= 1000; i++) {
|
||||
array.add("hello");
|
||||
REQUIRE(array.size() == i);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user