4 * Copyright (C) 2009 Red Hat Inc.
9 * Copyright IBM, Corp. 2009
14 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
15 * See the COPYING.LIB file in the top-level directory.
21 #include "qemu-common.h"
24 * Public Interface test-cases
26 * (with some violations to access 'private' data)
29 START_TEST(qfloat_from_double_test)
32 const double value = -42.23423;
34 qf = qfloat_from_double(value);
35 fail_unless(qf != NULL);
36 fail_unless(qf->value == value);
37 fail_unless(qf->base.refcnt == 1);
38 fail_unless(qobject_type(QOBJECT(qf)) == QTYPE_QFLOAT);
40 // destroy doesn't exit yet
45 START_TEST(qfloat_destroy_test)
47 QFloat *qf = qfloat_from_double(0.0);
52 static Suite *qfloat_suite(void)
55 TCase *qfloat_public_tcase;
57 s = suite_create("QFloat test-suite");
59 qfloat_public_tcase = tcase_create("Public Interface");
60 suite_add_tcase(s, qfloat_public_tcase);
61 tcase_add_test(qfloat_public_tcase, qfloat_from_double_test);
62 tcase_add_test(qfloat_public_tcase, qfloat_destroy_test);
74 sr = srunner_create(s);
76 srunner_run_all(sr, CK_NORMAL);
77 nf = srunner_ntests_failed(sr);
80 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;