mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 12:32:17 +02:00
Generator: added a test of one string in an array
This commit is contained in:
@ -7,16 +7,29 @@ namespace JsonGeneratorTests
|
||||
{
|
||||
TEST_CLASS(JsonArrayTests)
|
||||
{
|
||||
JsonArray<32> arr;
|
||||
|
||||
public:
|
||||
|
||||
TEST_METHOD(EmptyArray)
|
||||
{
|
||||
JsonArray arr;
|
||||
AssertJsonIs("[]");
|
||||
}
|
||||
|
||||
TEST_METHOD(OneString)
|
||||
{
|
||||
arr.add("hello");
|
||||
|
||||
AssertJsonIs("['hello']");
|
||||
}
|
||||
|
||||
void AssertJsonIs(const char* expected)
|
||||
{
|
||||
char buffer[256];
|
||||
|
||||
arr.writeTo(buffer, sizeof(buffer));
|
||||
|
||||
Assert::AreEqual("[]", buffer);
|
||||
Assert::AreEqual(expected, buffer);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user