Revision 9c9efb6b

b/Makefile
229 229
check-qstring: check-qstring.o qstring.o qemu-malloc.o
230 230
check-qdict: check-qdict.o qdict.o qint.o qstring.o qemu-malloc.o
231 231
check-qlist: check-qlist.o qlist.o qint.o qemu-malloc.o
232
check-qfloat: check-qfloat.o qfloat.o qemu-malloc.o
232 233

  
233 234
clean:
234 235
# avoid old build problems by removing potentially incorrect old files
b/check-qfloat.c
1
/*
2
 * QFloat unit-tests.
3
 *
4
 * Copyright (C) 2009 Red Hat Inc.
5
 *
6
 * Authors:
7
 *  Luiz Capitulino <lcapitulino@redhat.com>
8
 *
9
 * Copyright IBM, Corp. 2009
10
 *
11
 * Authors:
12
 *  Anthony Liguori   <aliguori@us.ibm.com>
13
 *
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.
16
 *
17
 */
18
#include <check.h>
19

  
20
#include "qfloat.h"
21
#include "qemu-common.h"
22

  
23
/*
24
 * Public Interface test-cases
25
 *
26
 * (with some violations to access 'private' data)
27
 */
28

  
29
START_TEST(qfloat_from_double_test)
30
{
31
    QFloat *qf;
32
    const double value = -42.23423;
33

  
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);
39

  
40
    // destroy doesn't exit yet
41
    qemu_free(qf);
42
}
43
END_TEST
44

  
45
START_TEST(qfloat_destroy_test)
46
{
47
    QFloat *qf = qfloat_from_double(0.0);
48
    QDECREF(qf);
49
}
50
END_TEST
51

  
52
static Suite *qfloat_suite(void)
53
{
54
    Suite *s;
55
    TCase *qfloat_public_tcase;
56

  
57
    s = suite_create("QFloat test-suite");
58

  
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);
63

  
64
    return s;
65
}
66

  
67
int main(void)
68
{
69
    int nf;
70
    Suite *s;
71
    SRunner *sr;
72

  
73
    s = qfloat_suite();
74
    sr = srunner_create(s);
75

  
76
    srunner_run_all(sr, CK_NORMAL);
77
    nf = srunner_ntests_failed(sr);
78
    srunner_free(sr);
79

  
80
    return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
81
}
b/configure
2092 2092
      tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
2093 2093
    if [ "$check_utests" = "yes" ]; then
2094 2094
      tools="check-qint check-qstring check-qdict check-qlist $tools"
2095
      tools="check-qfloat $tools"
2095 2096
    fi
2096 2097
  elif test "$mingw32" = "yes" ; then
2097 2098
      tools="qemu-io\$(EXESUF) $tools"

Also available in: Unified diff