- Need to focus on rbutton mouse down. And redraw selection when
[mono.git] / eglib / test / sizes.c
1 /*
2  * Tests to ensure that our type definitions are correct
3  *
4  * These depend on -Werror, -Wall being set to catch the build error.
5  */
6 #include <stdio.h>
7 #include <stdint.h>
8 #include <string.h>
9 #include <glib.h>
10 #include "test.h"
11
12 RESULT
13 test_formats ()
14 {
15         char buffer [1024];
16         gsize a = 1;
17         
18         sprintf (buffer, "%" G_GSIZE_FORMAT, a);
19
20         return NULL;
21 }
22
23 RESULT
24 test_ptrconv ()
25 {
26         int iv, iv2;
27         unsigned int uv, uv2;
28         gpointer ptr;
29
30         iv = G_MAXINT32;
31         ptr = GINT_TO_POINTER (iv);
32         iv2 = GPOINTER_TO_INT (ptr);
33         if (iv != iv2)
34                 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
35
36         iv = G_MININT32;
37         ptr = GINT_TO_POINTER (iv);
38         iv2 = GPOINTER_TO_INT (ptr);
39         if (iv != iv2)
40                 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
41
42         iv = 1;
43         ptr = GINT_TO_POINTER (iv);
44         iv2 = GPOINTER_TO_INT (ptr);
45         if (iv != iv2)
46                 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
47
48         iv = -1;
49         ptr = GINT_TO_POINTER (iv);
50         iv2 = GPOINTER_TO_INT (ptr);
51         if (iv != iv2)
52                 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
53
54         iv = 0;
55         ptr = GINT_TO_POINTER (iv);
56         iv2 = GPOINTER_TO_INT (ptr);
57         if (iv != iv2)
58                 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
59
60         uv = 0;
61         ptr = GUINT_TO_POINTER (iv);
62         uv2 = GPOINTER_TO_UINT (ptr);
63         if (iv != iv2)
64                 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
65         
66         uv = 1;
67         ptr = GUINT_TO_POINTER (iv);
68         uv2 = GPOINTER_TO_UINT (ptr);
69         if (iv != iv2)
70                 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
71
72         uv = UINT32_MAX;
73         ptr = GUINT_TO_POINTER (iv);
74         uv2 = GPOINTER_TO_UINT (ptr);
75         if (iv != iv2)
76                 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
77
78         return NULL;
79         
80 }
81
82 static Test size_tests [] = {
83         {"formats", test_formats},
84         {"ptrconv", test_ptrconv},
85         {NULL, NULL}
86 };
87
88 DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)