tst_types.c revision d1154eb460efe588eaed3d439c1caaca149fa362
1/*
2 * This testing program makes sure the ext2_types header file
3 *
4 * Copyright (C) 2006 by Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Library
8 * General Public License, version 2.
9 * %End-Header%
10 */
11
12#include "config.h"
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16
17#include "ext2fs/ext2_types.h"
18
19int main(int argc, char **argv)
20{
21	if (sizeof(__u8) != 1) {
22		printf("Sizeof(__u8) is %d should be 1\n",
23		       (int)sizeof(__u8));
24		exit(1);
25	}
26	if (sizeof(__s8) != 1) {
27		printf("Sizeof(_s8) is %d should be 1\n",
28		       (int)sizeof(__s8));
29		exit(1);
30	}
31	if (sizeof(__u16) != 2) {
32		printf("Sizeof(__u16) is %d should be 2\n",
33		       (int)sizeof(__u16));
34		exit(1);
35	}
36	if (sizeof(__s16) != 2) {
37		printf("Sizeof(__s16) is %d should be 2\n",
38		       (int)sizeof(__s16));
39		exit(1);
40	}
41	if (sizeof(__u32) != 4) {
42		printf("Sizeof(__u32) is %d should be 4\n",
43		       (int)sizeof(__u32));
44		exit(1);
45	}
46	if (sizeof(__s32) != 4) {
47		printf("Sizeof(__s32) is %d should be 4\n",
48		       (int)sizeof(__s32));
49		exit(1);
50	}
51	if (sizeof(__u64) != 8) {
52		printf("Sizeof(__u64) is %d should be 8\n",
53		       (int)sizeof(__u64));
54		exit(1);
55	}
56	if (sizeof(__s64) != 8) {
57		printf("Sizeof(__s64) is %d should be 8\n",
58		       (int)sizeof(__s64));
59		exit(1);
60	}
61	printf("The ext2_types.h types are correct.\n");
62	exit(0);
63}
64
65