4 * Copyright IBM, Corp. 2009
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.
16 #include "qemu-common.h"
19 * Public Interface test-cases
21 * (with some violations to access 'private' data)
24 START_TEST(qfloat_from_double_test
)
27 const double value
= -42.23423;
29 qf
= qfloat_from_double(value
);
30 fail_unless(qf
!= NULL
);
31 fail_unless(qf
->value
== value
);
32 fail_unless(qf
->base
.refcnt
== 1);
33 fail_unless(qobject_type(QOBJECT(qf
)) == QTYPE_QFLOAT
);
35 // destroy doesn't exit yet
40 START_TEST(qfloat_destroy_test
)
42 QFloat
*qf
= qfloat_from_double(0.0);
47 static Suite
*qfloat_suite(void)
50 TCase
*qfloat_public_tcase
;
52 s
= suite_create("QFloat test-suite");
54 qfloat_public_tcase
= tcase_create("Public Interface");
55 suite_add_tcase(s
, qfloat_public_tcase
);
56 tcase_add_test(qfloat_public_tcase
, qfloat_from_double_test
);
57 tcase_add_test(qfloat_public_tcase
, qfloat_destroy_test
);
69 sr
= srunner_create(s
);
71 srunner_run_all(sr
, CK_NORMAL
);
72 nf
= srunner_ntests_failed(sr
);
75 return (nf
== 0) ? EXIT_SUCCESS
: EXIT_FAILURE
;