tst_types.c revision 4aec958561923bcfd138534d6ff64273b7427a9c
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 Public
8 * License.
9 * %End-Header%
10 */
11
12#include <stdio.h>
13#include <stdlib.h>
14#include <unistd.h>
15
16#include "ext2fs/ext2_types.h"
17
18main(int argc, char **argv)
19{
20	if (sizeof(__u8) != 1) {
21		printf("Sizeof(__u8) is %d should be 1\n",
22		       sizeof(__u8));
23		exit(1);
24	}
25	if (sizeof(__s8) != 1) {
26		printf("Sizeof(_s8) is %d should be 1\n",
27		       sizeof(__s8));
28		exit(1);
29	}
30	if (sizeof(__u16) != 2) {
31		printf("Sizeof(__u16) is %d should be 2\n",
32		       sizeof(__u16));
33		exit(1);
34	}
35	if (sizeof(__s16) != 2) {
36		printf("Sizeof(__s16) is %d should be 2\n",
37		       sizeof(__s16));
38		exit(1);
39	}
40	if (sizeof(__u32) != 4) {
41		printf("Sizeof(__u32) is %d should be 4\n",
42		       sizeof(__u32));
43		exit(1);
44	}
45	if (sizeof(__s32) != 4) {
46		printf("Sizeof(__s32) is %d should be 4\n",
47		       sizeof(__s32));
48		exit(1);
49	}
50	if (sizeof(__u64) != 8) {
51		printf("Sizeof(__u64) is %d should be 8\n",
52		       sizeof(__u64));
53		exit(1);
54	}
55	if (sizeof(__s64) != 8) {
56		printf("Sizeof(__s64) is %d should be 8\n",
57		       sizeof(__s64));
58		exit(1);
59	}
60	printf("The ext2_types.h types are correct.\n");
61	exit(0);
62}
63
64