From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkHea-0007SD-GY for qemu-devel@nongnu.org; Mon, 09 Jan 2012 11:00:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkHeP-0002DG-R8 for qemu-devel@nongnu.org; Mon, 09 Jan 2012 11:00:56 -0500 Received: from e2.ny.us.ibm.com ([32.97.182.142]:52980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkHeP-0002D5-OL for qemu-devel@nongnu.org; Mon, 09 Jan 2012 11:00:45 -0500 Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Jan 2012 11:00:44 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q09FuRE8379018 for ; Mon, 9 Jan 2012 10:56:28 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q09FuNo0008581 for ; Mon, 9 Jan 2012 13:56:23 -0200 From: Anthony Liguori Date: Mon, 9 Jan 2012 09:56:05 -0600 Message-Id: <1326124572-8312-4-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1326124572-8312-1-git-send-email-aliguori@us.ibm.com> References: <1326124572-8312-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 04/11] check-qfloat: convert to gtest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Luiz Capitulino Signed-off-by: Anthony Liguori --- check-qfloat.c | 47 ++++++++++++----------------------------------- configure | 4 ++-- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/check-qfloat.c b/check-qfloat.c index 3344057..cdc66ea 100644 --- a/check-qfloat.c +++ b/check-qfloat.c @@ -10,7 +10,7 @@ * See the COPYING.LIB file in the top-level directory. * */ -#include +#include #include "qfloat.h" #include "qemu-common.h" @@ -21,56 +21,33 @@ * (with some violations to access 'private' data) */ -START_TEST(qfloat_from_double_test) +static void qfloat_from_double_test(void) { QFloat *qf; const double value = -42.23423; qf = qfloat_from_double(value); - fail_unless(qf != NULL); - fail_unless(qf->value == value); - fail_unless(qf->base.refcnt == 1); - fail_unless(qobject_type(QOBJECT(qf)) == QTYPE_QFLOAT); + g_assert(qf != NULL); + g_assert(qf->value == value); + g_assert(qf->base.refcnt == 1); + g_assert(qobject_type(QOBJECT(qf)) == QTYPE_QFLOAT); // destroy doesn't exit yet g_free(qf); } -END_TEST -START_TEST(qfloat_destroy_test) +static void qfloat_destroy_test(void) { QFloat *qf = qfloat_from_double(0.0); QDECREF(qf); } -END_TEST -static Suite *qfloat_suite(void) +int main(int argc, char **argv) { - Suite *s; - TCase *qfloat_public_tcase; + g_test_init(&argc, &argv, NULL); - s = suite_create("QFloat test-suite"); + g_test_add_func("/public/from_double", qfloat_from_double_test); + g_test_add_func("/public/destroy", qfloat_destroy_test); - qfloat_public_tcase = tcase_create("Public Interface"); - suite_add_tcase(s, qfloat_public_tcase); - tcase_add_test(qfloat_public_tcase, qfloat_from_double_test); - tcase_add_test(qfloat_public_tcase, qfloat_destroy_test); - - return s; -} - -int main(void) -{ - int nf; - Suite *s; - SRunner *sr; - - s = qfloat_suite(); - sr = srunner_create(s); - - srunner_run_all(sr, CK_NORMAL); - nf = srunner_ntests_failed(sr); - srunner_free(sr); - - return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; + return g_test_run(); } diff --git a/configure b/configure index 7e3f28f..a7a6758 100755 --- a/configure +++ b/configure @@ -2801,9 +2801,9 @@ if test "$softmmu" = yes ; then fi if [ "$check_utests" = "yes" ]; then checks="check-qint check-qstring check-qlist" - checks="check-qfloat check-qjson $checks" + checks="check-qjson $checks" fi - test_progs="$checks check-qdict test-coroutine test-qmp-output-visitor test-qmp-input-visitor" + test_progs="$checks check-qdict check-qfloat test-coroutine test-qmp-output-visitor test-qmp-input-visitor" fi fi -- 1.7.4.1