eepro100: Fix compiler errors from debug messages
[qemu/agraf.git] / check-qfloat.c
blob3758700cb845add6a3b82f0415a666e40158b9f0
1 /*
2 * QFloat unit-tests.
4 * Copyright (C) 2009 Red Hat Inc.
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
9 * Copyright IBM, Corp. 2009
11 * Authors:
12 * Anthony Liguori <aliguori@us.ibm.com>
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.
18 #include <check.h>
20 #include "qfloat.h"
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)
31 QFloat *qf;
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
41 qemu_free(qf);
43 END_TEST
45 START_TEST(qfloat_destroy_test)
47 QFloat *qf = qfloat_from_double(0.0);
48 QDECREF(qf);
50 END_TEST
52 static Suite *qfloat_suite(void)
54 Suite *s;
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);
64 return s;
67 int main(void)
69 int nf;
70 Suite *s;
71 SRunner *sr;
73 s = qfloat_suite();
74 sr = srunner_create(s);
76 srunner_run_all(sr, CK_NORMAL);
77 nf = srunner_ntests_failed(sr);
78 srunner_free(sr);
80 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;