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