mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 20:42:24 +02:00
Generator: added a test of an array with 2 strings
This commit is contained in:
@ -28,6 +28,9 @@ public:
|
||||
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
if (i>0)
|
||||
append(",", buffer, bufferSize);
|
||||
|
||||
append("'", buffer, bufferSize);
|
||||
append(items[i], buffer, bufferSize);
|
||||
append("'", buffer, bufferSize);
|
||||
|
@ -7,7 +7,7 @@ namespace JsonGeneratorTests
|
||||
{
|
||||
TEST_CLASS(JsonArrayTests)
|
||||
{
|
||||
JsonArray<32> arr;
|
||||
JsonArray<3> arr;
|
||||
|
||||
public:
|
||||
|
||||
@ -23,6 +23,14 @@ namespace JsonGeneratorTests
|
||||
AssertJsonIs("['hello']");
|
||||
}
|
||||
|
||||
TEST_METHOD(TwoStrings)
|
||||
{
|
||||
arr.add("hello");
|
||||
arr.add("world");
|
||||
|
||||
AssertJsonIs("['hello','world']");
|
||||
}
|
||||
|
||||
void AssertJsonIs(const char* expected)
|
||||
{
|
||||
char buffer[256];
|
||||
|
Reference in New Issue
Block a user