rng: switch request queue to QSIMPLEQ
[qemu/kevin.git] / tests / check-qfloat.c
blob3102608f55a06e63ac8e771e740e72f85528efb5
1 /*
2 * QFloat unit-tests.
4 * Copyright IBM, Corp. 2009
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
13 #include "qemu/osdep.h"
14 #include <glib.h>
16 #include "qapi/qmp/qfloat.h"
17 #include "qemu-common.h"
20 * Public Interface test-cases
22 * (with some violations to access 'private' data)
25 static void qfloat_from_double_test(void)
27 QFloat *qf;
28 const double value = -42.23423;
30 qf = qfloat_from_double(value);
31 g_assert(qf != NULL);
32 g_assert(qf->value == value);
33 g_assert(qf->base.refcnt == 1);
34 g_assert(qobject_type(QOBJECT(qf)) == QTYPE_QFLOAT);
36 // destroy doesn't exit yet
37 g_free(qf);
40 static void qfloat_destroy_test(void)
42 QFloat *qf = qfloat_from_double(0.0);
43 QDECREF(qf);
46 int main(int argc, char **argv)
48 g_test_init(&argc, &argv, NULL);
50 g_test_add_func("/public/from_double", qfloat_from_double_test);
51 g_test_add_func("/public/destroy", qfloat_destroy_test);
53 return g_test_run();