diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-12-10 17:14:47 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-12-19 10:37:16 +0100 |
commit | 1a9076919f5367309ee8d89b91aae5330dec37d6 (patch) | |
tree | c7fdd68b3ad405a18d0bc10bedd820a0b69ed383 /tests | |
parent | 780df5d42befde9293cd667e1e237f26bcf37e94 (diff) |
tests/check-qnum: Cover qnum_to_string() for "unround" argument
qnum_to_string() has a FIXME comment about rounding errors due to
insufficient precision. Cover it: 2.718281828459045 gets converted to
"2.718282". The next commit will fix it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201210161452.2813491-6-armbru@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-qnum.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/check-qnum.c b/tests/check-qnum.c index 4105015872..a73809d021 100644 --- a/tests/check-qnum.c +++ b/tests/check-qnum.c @@ -150,6 +150,12 @@ static void qnum_to_string_test(void) g_assert_cmpstr(tmp, ==, "0.42"); g_free(tmp); qobject_unref(qn); + + qn = qnum_from_double(2.718281828459045); + tmp = qnum_to_string(qn); + g_assert_cmpstr(tmp, ==, "2.718282"); /* BUG */ + g_free(tmp); + qobject_unref(qn); } int main(int argc, char **argv) |