From patchwork Sat Oct 17 13:36:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 36310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7586EB7088 for ; Sun, 18 Oct 2009 00:53:25 +1100 (EST) Received: from localhost ([127.0.0.1]:53917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz9ik-0004Zp-GM for incoming@patchwork.ozlabs.org; Sat, 17 Oct 2009 09:53:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mz9SN-0005oo-OG for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mz9SH-0005lB-E3 for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:26 -0400 Received: from [199.232.76.173] (port=58967 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mz9SG-0005ko-TW for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:21 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:49413) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mz9SG-0000Or-IX for qemu-devel@nongnu.org; Sat, 17 Oct 2009 09:36:20 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e37.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9HDZDrN023768 for ; Sat, 17 Oct 2009 07:35:13 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n9HDaFwh250288 for ; Sat, 17 Oct 2009 07:36:15 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9HDaFaw021661 for ; Sat, 17 Oct 2009 07:36:15 -0600 Received: from localhost.localdomain (sig-9-65-54-101.mts.ibm.com [9.65.54.101]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n9HDaBJJ021369; Sat, 17 Oct 2009 07:36:15 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Sat, 17 Oct 2009 08:36:09 -0500 Message-Id: <1255786571-3528-10-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1255786571-3528-1-git-send-email-aliguori@us.ibm.com> References: <1255786571-3528-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 09/11] qjson: add unit test for varargs bool parsing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- check-qjson.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/check-qjson.c b/check-qjson.c index 32aa33c..8760941 100644 --- a/check-qjson.c +++ b/check-qjson.c @@ -9,6 +9,7 @@ * */ #include +#include #include "qstring.h" #include "qint.h" @@ -282,6 +283,26 @@ START_TEST(keyword_literal) fail_unless(qbool_get_int(qbool) == 0); QDECREF(qbool); + + obj = qobject_from_jsonf("%i", &length, false); + fail_unless(obj != NULL); + fail_unless(qobject_type(obj) == QTYPE_QBOOL); + fail_unless(length == 2); + + qbool = qobject_to_qbool(obj); + fail_unless(qbool_get_int(qbool) == 0); + + QDECREF(qbool); + + obj = qobject_from_jsonf("%i", &length, true); + fail_unless(obj != NULL); + fail_unless(qobject_type(obj) == QTYPE_QBOOL); + fail_unless(length == 2); + + qbool = qobject_to_qbool(obj); + fail_unless(qbool_get_int(qbool) != 0); + + QDECREF(qbool); } END_TEST