Generator: added a test of one string in an array

This commit is contained in:
Benoît Blanchon
2014-06-24 13:34:55 +02:00
parent c8c1add4ab
commit f18f554c2f
5 changed files with 54 additions and 9 deletions

View File

@ -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);
}
};
}