summaryrefslogtreecommitdiffstats
path: root/test/tconfig.c
blob: 077c472d427915c315799cf6703d49b894795a18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/****************************************************************************
 * NCSA HDF                                                                 *
 * Scientic Data Team							    *
 * National Center for Supercomputing Applications                          *
 * University of Illinois at Urbana-Champaign                               *
 * 605 E. Springfield, Champaign IL 61820                                   *
 *                                                                          *
 * For conditions of distribution and use, see the accompanying             *
 * COPYING file.                                                            *
 *                                                                          *
 ****************************************************************************/

/* $Id$ */

/***********************************************************
*
* Test program:  tconfig
*
* Test the definitions in the H5config.h as much as possible
*
*************************************************************/

#include "hdf5.h"
#include "H5private.h"
#include "testhdf5.h"

/* macros definitions */
/* verify C type sizes */
#define vrfy_ctype(ctype, ctype_macro) \
    if (sizeof(ctype) != ctype_macro){ \
	print_func("Error verfying %s expected: %d, got: %d\n", \
	    #ctype_macro, ctype_macro, sizeof(ctype)); \
	    num_errs++; \
    }

/* local routine prototypes */
void test_config_ctypes(void);


/*-------------------------------------------------------------------------
 * Function:	test_configure
 *
 * Purpose:	Main configure definitions testing routine
 *
 * Return:	none (error is fed back via global variable num_errs)
 *
 * Programmer:	Albert Cheng
 *              September 25, 2001
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void 
test_configure(void)
{
    /* Output message about test being performed */
    MESSAGE(5, ("Testing configure definitions\n"));
    test_config_ctypes();
}


/*-------------------------------------------------------------------------
 * Function:	cleanup_configure
 *
 * Purpose:	Cleanup temporary test files
 *
 * Return:	none
 *
 * Programmer:	Albert Cheng
 *              September 25, 2001
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void
cleanup_configure(void)
{
    /* no file to clean */
}


/*-------------------------------------------------------------------------
 * Function:	test_config_ctypes
 *
 * Purpose:	test C language data type sizes
 *
 * Return:	none (error is fed back via global variable num_errs)
 *
 * Programmer:	Albert Cheng
 *              September 25, 2001
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void 
test_config_ctypes(void)
{
    /* standard basic types */
    vrfy_ctype(char, SIZEOF_CHAR);
    vrfy_ctype(int, SIZEOF_INT);
    vrfy_ctype(short, SIZEOF_SHORT);
    vrfy_ctype(long, SIZEOF_LONG);
    vrfy_ctype(float, SIZEOF_FLOAT);
    vrfy_ctype(double, SIZEOF_DOUBLE);

    /* non-standard basic types */
#ifdef HAVE___int64
#if SIZEOF___INT64 >0
    vrfy_ctype(__int64,SIZEOF___INT64);
#endif
#else
#if SIZEOF_LONG_LONG > 0
    vrfy_ctype(long long, SIZEOF_LONG_LONG);
#endif
#endif

#if SIZEOF_LONG_DOUBLE > 0
    vrfy_ctype(long double, SIZEOF_LONG_DOUBLE);
#endif

#if SIZEOF_UINT8_T > 0
    vrfy_ctype(uint8_t, SIZEOF_UINT8_T);
#endif

#if SIZEOF_UINT16_T > 0
    vrfy_ctype(uint16_t, SIZEOF_UINT16_T);
#endif

#if SIZEOF_UINT32_T > 0
    vrfy_ctype(uint32_t, SIZEOF_UINT32_T);
#endif

#if SIZEOF_UINT64_T > 0
    vrfy_ctype(uint64_t, SIZEOF_UINT64_T);
#endif

#if SIZEOF_UINT_FAST8_T > 0
    vrfy_ctype(uint_fast8_t, SIZEOF_UINT_FAST8_T);
#endif

#if SIZEOF_UINT_FAST16_T > 0
    vrfy_ctype(uint_fast16_t, SIZEOF_UINT_FAST16_T);
#endif

#if SIZEOF_UINT_FAST32_T > 0
    vrfy_ctype(uint_fast32_t, SIZEOF_UINT_FAST32_T);
#endif

#if SIZEOF_UINT_FAST64_T > 0
    vrfy_ctype(uint_fast64_t, SIZEOF_UINT_FAST64_T);
#endif

#if SIZEOF_UINT_LEAST8_T > 0
    vrfy_ctype(uint_least8_t, SIZEOF_UINT_LEAST8_T);
#endif

#if SIZEOF_UINT_LEAST16_T > 0
    vrfy_ctype(uint_least16_t, SIZEOF_UINT_LEAST16_T);
#endif

#if SIZEOF_UINT_LEAST32_T > 0
    vrfy_ctype(uint_least32_t, SIZEOF_UINT_LEAST32_T);
#endif

#if SIZEOF_UINT_LEAST64_T > 0
    vrfy_ctype(uint_least64_t, SIZEOF_UINT_LEAST64_T);
#endif

    /* pseudo standard basic types */
#if SIZEOF___INT64 > 0
    vrfy_ctype(__int64, SIZEOF___INT64);
#endif

#if SIZEOF_OFF_T > 0
    vrfy_ctype(off_t, SIZEOF_OFF_T);
#endif

#if SIZEOF_SIZE_T > 0
    vrfy_ctype(size_t, SIZEOF_SIZE_T);
#endif

#if SIZEOF_SSIZE_T > 0
    vrfy_ctype(ssize_t, SIZEOF_SSIZE_T);
#endif

}