mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Added a test that stores an integer in a JsonValue
This commit is contained in:
		| @@ -15,7 +15,7 @@ public: | |||||||
|     JsonValue() |     JsonValue() | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
|  |      | ||||||
|     JsonValue(bool value) |     JsonValue(bool value) | ||||||
|         : implementation(&JsonValue::printBoolTo) |         : implementation(&JsonValue::printBoolTo) | ||||||
|     { |     { | ||||||
| @@ -34,6 +34,10 @@ public: | |||||||
|         content.asLong = value; |         content.asLong = value; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     JsonValue(int value) : JsonValue((long) value) | ||||||
|  |     {         | ||||||
|  |     } | ||||||
|  |  | ||||||
|     JsonValue(Printable& value) |     JsonValue(Printable& value) | ||||||
|         : implementation(&JsonValue::printPrintableTo) |         : implementation(&JsonValue::printPrintableTo) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -83,6 +83,20 @@ namespace JsonGeneratorTests | |||||||
|             assertResultIs("3.14"); |             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) |         TEST_METHOD(Long) | ||||||
|         { |         { | ||||||
|             write(314L); |             write(314L); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user