~ubuntu-branches/ubuntu/trusty/util-linux/trusty-proposed

« back to all changes in this revision

Viewing changes to libblkid/src/tst_types.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2011-11-03 15:38:23 UTC
  • mto: (4.5.5 sid) (1.6.4)
  • mto: This revision was merged to the branch mainline in revision 85.
  • Revision ID: package-import@ubuntu.com-20111103153823-10sx16jprzxlhkqf
ImportĀ upstreamĀ versionĀ 2.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This testing program makes sure the stdint.h 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 <sys/types.h>
 
13
#include <stdint.h>
 
14
 
 
15
#include <stdlib.h>
 
16
#include <stdio.h>
 
17
 
 
18
int main(int argc, char **argv)
 
19
{
 
20
        if (sizeof(uint8_t) != 1) {
 
21
                printf("Sizeof(uint8_t) is %d should be 1\n",
 
22
                       (int)sizeof(uint8_t));
 
23
                exit(1);
 
24
        }
 
25
        if (sizeof(int8_t) != 1) {
 
26
                printf("Sizeof(int8_t) is %d should be 1\n",
 
27
                       (int)sizeof(int8_t));
 
28
                exit(1);
 
29
        }
 
30
        if (sizeof(uint16_t) != 2) {
 
31
                printf("Sizeof(uint16_t) is %d should be 2\n",
 
32
                       (int)sizeof(uint16_t));
 
33
                exit(1);
 
34
        }
 
35
        if (sizeof(int16_t) != 2) {
 
36
                printf("Sizeof(int16_t) is %d should be 2\n",
 
37
                       (int)sizeof(int16_t));
 
38
                exit(1);
 
39
        }
 
40
        if (sizeof(uint32_t) != 4) {
 
41
                printf("Sizeof(uint32_t) is %d should be 4\n",
 
42
                       (int)sizeof(uint32_t));
 
43
                exit(1);
 
44
        }
 
45
        if (sizeof(int32_t) != 4) {
 
46
                printf("Sizeof(int32_t) is %d should be 4\n",
 
47
                       (int)sizeof(int32_t));
 
48
                exit(1);
 
49
        }
 
50
        if (sizeof(uint64_t) != 8) {
 
51
                printf("Sizeof(uint64_t) is %d should be 8\n",
 
52
                       (int)sizeof(uint64_t));
 
53
                exit(1);
 
54
        }
 
55
        if (sizeof(int64_t) != 8) {
 
56
                printf("Sizeof(int64_t) is %d should be 8\n",
 
57
                       (int)sizeof(int64_t));
 
58
                exit(1);
 
59
        }
 
60
        printf("The stdint.h types are correct.\n");
 
61
        exit(0);
 
62
}
 
63