Debian Codegraph @

tests/check_sizes.c

raw
1 /* Copyright (C) 2008 Vincent Penquerc'h.
2 This file is part of the Kate codec library.
3 Written by Vincent Penquerc'h.
4
5 Use, distribution and reproduction of this library is governed
6 by a BSD style source license included with this source in the
7 file 'COPYING'. Please read these terms before distributing. */
8
9
10 #include <stdio.h>
11 #include "kate/kate.h"
12
13 static void ksz_print(const char *type,size_t sz)
14 {
15 printf("sizeof %-24s %6zu ",type,sz);
16 }
17
18 #define KSZA(type,size) \
19 do { \
20 size_t sz=size; \
21 ksz_print(#type,sizeof(type)); \
22 if (sz!=sizeof(type)) { \
23 printf("ERROR (expected %zu)",sz); \
24 ret=1; \
25 } \
26 else { \
27 printf("OK"); \
28 } \
29 printf("\n"); \
30 } while(0)
31
32 #ifdef __x86_64__
33 #ifdef __ILP32__
34 #define KSZ(type,sz32,sz64) KSZA(type,sz32)
35 #else
36 #define KSZ(type,sz32,sz64) KSZA(type,sz64)
37 #endif
38 #elif defined __i386__
39 #define KSZ(type,sz32,sz64) KSZA(type,sz32)
40 #else
41 #define KSZ(type,sz32,sz64) do { return 77; } while(0)
42 #endif
43
44 int main()
45 {
46 int ret=0;
47 KSZ(kate_region,52,80);
48 KSZ(kate_color,4,4);
49 KSZ(kate_style,96,136);
50 KSZ(kate_curve,32,64);
51 KSZ(kate_motion,48,80);
52 KSZ(kate_palette,16,32);
53 KSZ(kate_bitmap,100,176);
54 KSZ(kate_font_range,32,56);
55 KSZ(kate_font_mapping,32,64);
56 KSZ(kate_info,216,400);
57 KSZ(kate_state,32,64);
58 KSZ(kate_comment,16,32);
59 KSZ(kate_event,176,312);
60 KSZ(kate_tracker,336,464);
61 KSZ(kate_packet,8,16);
62 return ret;
63 }
64