test-string-output-visitor: Cover "unround" number
This demonstrates rounding error due to insufficient precision: double 3.1415926535897932 gets converted to JSON 3.141593. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201210161452.2813491-8-armbru@redhat.com>
This commit is contained in:
parent
f917eed306
commit
7b205a7373
@ -130,13 +130,13 @@ static void test_visitor_out_bool(TestOutputVisitorData *data,
|
|||||||
static void test_visitor_out_number(TestOutputVisitorData *data,
|
static void test_visitor_out_number(TestOutputVisitorData *data,
|
||||||
const void *unused)
|
const void *unused)
|
||||||
{
|
{
|
||||||
double value = 3.14;
|
double value = 3.1415926535897932;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
visit_type_number(data->ov, NULL, &value, &error_abort);
|
visit_type_number(data->ov, NULL, &value, &error_abort);
|
||||||
|
|
||||||
str = visitor_get(data);
|
str = visitor_get(data);
|
||||||
g_assert_cmpstr(str, ==, "3.140000");
|
g_assert_cmpstr(str, ==, "3.141593");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_visitor_out_string(TestOutputVisitorData *data,
|
static void test_visitor_out_string(TestOutputVisitorData *data,
|
||||||
|
Loading…
Reference in New Issue
Block a user