From 61e53a505d1f6a23d5965886b93b74ead8d5a9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Wed, 2 Jul 2014 13:06:38 +0200 Subject: [PATCH] Added a test that stores an integer in a JsonValue --- JsonGenerator/JsonValue.h | 6 +++++- JsonGeneratorTests/JsonValueTests.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/JsonGenerator/JsonValue.h b/JsonGenerator/JsonValue.h index 7940ff90..bc084637 100644 --- a/JsonGenerator/JsonValue.h +++ b/JsonGenerator/JsonValue.h @@ -15,7 +15,7 @@ public: JsonValue() { } - + JsonValue(bool value) : implementation(&JsonValue::printBoolTo) { @@ -34,6 +34,10 @@ public: content.asLong = value; } + JsonValue(int value) : JsonValue((long) value) + { + } + JsonValue(Printable& value) : implementation(&JsonValue::printPrintableTo) { diff --git a/JsonGeneratorTests/JsonValueTests.cpp b/JsonGeneratorTests/JsonValueTests.cpp index 24ec0473..adf47c7b 100644 --- a/JsonGeneratorTests/JsonValueTests.cpp +++ b/JsonGeneratorTests/JsonValueTests.cpp @@ -83,6 +83,20 @@ namespace JsonGeneratorTests assertResultIs("3.14"); } + TEST_METHOD(Integer) + { + write(314); + assertReturns(3); + assertResultIs("314"); + } + + TEST_METHOD(Short) + { + write((short)314); + assertReturns(3); + assertResultIs("314"); + } + TEST_METHOD(Long) { write(314L);