qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Riteau <Pierre.Riteau@irisa.fr>
To: qemu-devel@nongnu.org
Cc: Pierre Riteau <Pierre.Riteau@irisa.fr>
Subject: [Qemu-devel] [PATCH] Fix and improve qint_from_int64_test
Date: Tue,  8 Sep 2009 11:53:37 +0200	[thread overview]
Message-ID: <1252403617-30464-1-git-send-email-Pierre.Riteau@irisa.fr> (raw)

Use a long long integer constant to fix a compilation error (integer
constant is too large for 'long' type).

Use a better value for testing, as -1 makes the test pass even if
qi->value is of type uint32_t, float or double. This was suggested by
Reimar Döffinger <Reimar.Doeffinger@gmx.de>.

Also, make the test fail when qi->value is of type double or float by
casting qi->value to int64_t, to avoid value being promoted to the type
of qi->value.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
---
 check-qint.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/check-qint.c b/check-qint.c
index ae5d22f..49887bb 100644
--- a/check-qint.c
+++ b/check-qint.c
@@ -43,10 +43,10 @@ END_TEST
 START_TEST(qint_from_int64_test)
 {
     QInt *qi;
-    const int64_t value = 0xffffffffffffffff;
+    const int64_t value = 0x1234567890abcdefLL;
 
     qi = qint_from_int(value);
-    fail_unless(qi->value == value);
+    fail_unless((int64_t) qi->value == value);
 
     QDECREF(qi);
 }
-- 
1.6.3.3

             reply	other threads:[~2009-09-08  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-08  9:53 Pierre Riteau [this message]
2009-09-09 13:41 ` [Qemu-devel] [PATCH] Fix and improve qint_from_int64_test Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252403617-30464-1-git-send-email-Pierre.Riteau@irisa.fr \
    --to=pierre.riteau@irisa.fr \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).