forked from bblanchon/ArduinoJson
Now also test the return value
This commit is contained in:
@ -12,17 +12,18 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(IntentedPrintTests)
|
TEST_CLASS(IntentedPrintTests)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[1024];
|
||||||
|
size_t returnValue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TEST_METHOD(EmptyString)
|
TEST_METHOD(EmptyString)
|
||||||
{
|
{
|
||||||
whenInputIs("");
|
whenInputIs("");
|
||||||
outputMustBe("");
|
outputMustBe("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -31,12 +32,13 @@ namespace JsonGeneratorTests
|
|||||||
StringBuilder sb(buffer, sizeof(buffer));
|
StringBuilder sb(buffer, sizeof(buffer));
|
||||||
IndentedPrintDecorator decorator(sb);
|
IndentedPrintDecorator decorator(sb);
|
||||||
|
|
||||||
decorator.print(input);
|
returnValue = decorator.print(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void outputMustBe(const char* expected)
|
void outputMustBe(const char* expected)
|
||||||
{
|
{
|
||||||
Assert::AreEqual(expected, buffer);
|
Assert::AreEqual(expected, buffer);
|
||||||
|
Assert::AreEqual(strlen(expected), returnValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
Reference in New Issue
Block a user