mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 12:32:17 +02:00
Added overload to add() to specify the double precision
This commit is contained in:
@ -54,6 +54,12 @@ namespace JsonGeneratorTests
|
||||
jsonIs("[\"hello\",\"world\"]");
|
||||
}
|
||||
|
||||
TEST_METHOD(OneDouble)
|
||||
{
|
||||
addValue(3.14159265358979323846, 4);
|
||||
jsonIs("[3.1416]");
|
||||
}
|
||||
|
||||
TEST_METHOD(OneInteger)
|
||||
{
|
||||
addValue(1);
|
||||
@ -160,6 +166,11 @@ namespace JsonGeneratorTests
|
||||
arr.add(value);
|
||||
}
|
||||
|
||||
void addValue(double value, int digits)
|
||||
{
|
||||
arr.add(value, digits);
|
||||
}
|
||||
|
||||
void jsonIs(const char* expected)
|
||||
{
|
||||
arr.printTo(buffer, sizeof(buffer));
|
||||
|
Reference in New Issue
Block a user