Added overload to add() to specify the double precision

This commit is contained in:
Benoît Blanchon
2014-07-03 13:45:53 +02:00
parent 5b1c2047a4
commit daba65d987
4 changed files with 34 additions and 21 deletions

View File

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