mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 20:42:24 +02:00
Test empty object serialization
This commit is contained in:
30
tests/JsonObjectSerializationTests.cpp
Normal file
30
tests/JsonObjectSerializationTests.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <JsonObject.h>
|
||||
#include <StaticJsonBuffer.h>
|
||||
|
||||
class JsonObjectSerializationTests : public testing::Test
|
||||
{
|
||||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
object = json.createObject();
|
||||
}
|
||||
|
||||
void jsonMustBe(const char* expected)
|
||||
{
|
||||
char actual[256];
|
||||
object.serialize(actual, sizeof(actual));
|
||||
|
||||
EXPECT_STREQ(expected, actual);
|
||||
}
|
||||
|
||||
JsonObject object;
|
||||
|
||||
private:
|
||||
StaticJsonBuffer<42> json;
|
||||
};
|
||||
|
||||
TEST_F(JsonObjectSerializationTests, EmptyObject)
|
||||
{
|
||||
jsonMustBe("{}");
|
||||
}
|
Reference in New Issue
Block a user