diff options
-rw-r--r-- | check-qint.c | 68 | ||||
-rwxr-xr-x | configure | 4 |
2 files changed, 23 insertions, 49 deletions
diff --git a/check-qint.c b/check-qint.c index 3af51f20c8..5a27119ae2 100644 --- a/check-qint.c +++ b/check-qint.c @@ -9,7 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. */ -#include <check.h> +#include <glib.h> #include "qint.h" #include "qemu-common.h" @@ -20,94 +20,68 @@ * (with some violations to access 'private' data) */ -START_TEST(qint_from_int_test) +static void qint_from_int_test(void) { QInt *qi; const int value = -42; qi = qint_from_int(value); - fail_unless(qi != NULL); - fail_unless(qi->value == value); - fail_unless(qi->base.refcnt == 1); - fail_unless(qobject_type(QOBJECT(qi)) == QTYPE_QINT); + g_assert(qi != NULL); + g_assert(qi->value == value); + g_assert(qi->base.refcnt == 1); + g_assert(qobject_type(QOBJECT(qi)) == QTYPE_QINT); // destroy doesn't exit yet g_free(qi); } -END_TEST -START_TEST(qint_destroy_test) +static void qint_destroy_test(void) { QInt *qi = qint_from_int(0); QDECREF(qi); } -END_TEST -START_TEST(qint_from_int64_test) +static void qint_from_int64_test(void) { QInt *qi; const int64_t value = 0x1234567890abcdefLL; qi = qint_from_int(value); - fail_unless((int64_t) qi->value == value); + g_assert((int64_t) qi->value == value); QDECREF(qi); } -END_TEST -START_TEST(qint_get_int_test) +static void qint_get_int_test(void) { QInt *qi; const int value = 123456; qi = qint_from_int(value); - fail_unless(qint_get_int(qi) == value); + g_assert(qint_get_int(qi) == value); QDECREF(qi); } -END_TEST -START_TEST(qobject_to_qint_test) +static void qobject_to_qint_test(void) { QInt *qi; qi = qint_from_int(0); - fail_unless(qobject_to_qint(QOBJECT(qi)) == qi); + g_assert(qobject_to_qint(QOBJECT(qi)) == qi); QDECREF(qi); } -END_TEST -static Suite *qint_suite(void) +int main(int argc, char **argv) { - Suite *s; - TCase *qint_public_tcase; + g_test_init(&argc, &argv, NULL); - s = suite_create("QInt test-suite"); + g_test_add_func("/public/from_int", qint_from_int_test); + g_test_add_func("/public/destroy", qint_destroy_test); + g_test_add_func("/public/from_int64", qint_from_int64_test); + g_test_add_func("/public/get_int", qint_get_int_test); + g_test_add_func("/public/to_qint", qobject_to_qint_test); - qint_public_tcase = tcase_create("Public Interface"); - suite_add_tcase(s, qint_public_tcase); - tcase_add_test(qint_public_tcase, qint_from_int_test); - tcase_add_test(qint_public_tcase, qint_destroy_test); - tcase_add_test(qint_public_tcase, qint_from_int64_test); - tcase_add_test(qint_public_tcase, qint_get_int_test); - tcase_add_test(qint_public_tcase, qobject_to_qint_test); - - return s; -} - -int main(void) -{ - int nf; - Suite *s; - SRunner *sr; - - s = qint_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(); } @@ -2800,10 +2800,10 @@ if test "$softmmu" = yes ; then tools="qemu-ga\$(EXESUF) $tools" fi if [ "$check_utests" = "yes" ]; then - checks="check-qint check-qstring check-qlist" + checks="check-qstring check-qlist" checks="check-qjson $checks" fi - test_progs="$checks check-qdict check-qfloat test-coroutine test-qmp-output-visitor test-qmp-input-visitor" + test_progs="$checks check-qdict check-qfloat check-qint test-coroutine test-qmp-output-visitor test-qmp-input-visitor" fi fi |