Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MkxOO-0005un-1H for qemu-devel@nongnu.org; Tue, 08 Sep 2009 05:53:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MkxOI-0005pV-VE for qemu-devel@nongnu.org; Tue, 08 Sep 2009 05:53:39 -0400 Received: from [199.232.76.173] (port=53137 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MkxOI-0005pF-Kb for qemu-devel@nongnu.org; Tue, 08 Sep 2009 05:53:34 -0400 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:32706) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MkxOI-0006bz-2h for qemu-devel@nongnu.org; Tue, 08 Sep 2009 05:53:34 -0400 From: Pierre Riteau Date: Tue, 8 Sep 2009 11:53:37 +0200 Message-Id: <1252403617-30464-1-git-send-email-Pierre.Riteau@irisa.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] Fix and improve qint_from_int64_test List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pierre Riteau 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 . 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 --- 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