From 030c8542e7b3242a49e408f3f642576f06835a6f Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 25 Aug 2014 09:19:26 +0200 Subject: [PATCH] Now also test the return value --- JsonGeneratorTests/IntentedPrintTests.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/JsonGeneratorTests/IntentedPrintTests.cpp b/JsonGeneratorTests/IntentedPrintTests.cpp index 62e8b853..662ac5d5 100644 --- a/JsonGeneratorTests/IntentedPrintTests.cpp +++ b/JsonGeneratorTests/IntentedPrintTests.cpp @@ -12,17 +12,18 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace JsonGeneratorTests { - TEST_CLASS(IntentedPrintTests) - { - char buffer[256]; + TEST_CLASS(IntentedPrintTests) + { + char buffer[1024]; + size_t returnValue; - public: - - TEST_METHOD(EmptyString) - { + public: + + TEST_METHOD(EmptyString) + { whenInputIs(""); outputMustBe(""); - } + } private: @@ -31,12 +32,13 @@ namespace JsonGeneratorTests StringBuilder sb(buffer, sizeof(buffer)); IndentedPrintDecorator decorator(sb); - decorator.print(input); + returnValue = decorator.print(input); } void outputMustBe(const char* expected) { Assert::AreEqual(expected, buffer); + Assert::AreEqual(strlen(expected), returnValue); } - }; + }; } \ No newline at end of file