mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Test casting a JsonValue to a float
This commit is contained in:
		| @@ -74,6 +74,11 @@ namespace ArduinoJson | ||||
|                 return content.asDouble; | ||||
|             } | ||||
|  | ||||
|             operator float() | ||||
|             { | ||||
|                 return (float)content.asDouble; | ||||
|             } | ||||
|  | ||||
|             operator int() | ||||
|             { | ||||
|                 return content.asLong; | ||||
|   | ||||
| @@ -30,6 +30,11 @@ namespace JsonGeneratorTests | ||||
|             setValueAndCheckCast(3.14156); | ||||
|         } | ||||
|  | ||||
|         TEST_METHOD(Float) | ||||
|         { | ||||
|             setValueAndCheckCast(3.14f); | ||||
|         } | ||||
|  | ||||
|         TEST_METHOD(Integer) | ||||
|         { | ||||
|             setValueAndCheckCast(42); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user