summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster2020-12-10 17:14:49 +0100
committerMarkus Armbruster2020-12-19 10:37:16 +0100
commit7b205a7373c25db2f3680dee5a8c82e038135ec1 (patch)
treee6be2c959e7b9534bf1610a7cddc93342e6e5132 /tests
parentqobject: Fix qnum_to_string() to use sufficient precision (diff)
downloadqemu-7b205a7373c25db2f3680dee5a8c82e038135ec1.tar.gz
qemu-7b205a7373c25db2f3680dee5a8c82e038135ec1.tar.xz
qemu-7b205a7373c25db2f3680dee5a8c82e038135ec1.zip
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-string-output-visitor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 9f6581439a..cec20848ea 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -130,13 +130,13 @@ static void test_visitor_out_bool(TestOutputVisitorData *data,
static void test_visitor_out_number(TestOutputVisitorData *data,
const void *unused)
{
- double value = 3.14;
+ double value = 3.1415926535897932;
char *str;
visit_type_number(data->ov, NULL, &value, &error_abort);
str = visitor_get(data);
- g_assert_cmpstr(str, ==, "3.140000");
+ g_assert_cmpstr(str, ==, "3.141593");
}
static void test_visitor_out_string(TestOutputVisitorData *data,