2 * Tests to ensure that our type definitions are correct
4 * These depend on -Werror, -Wall being set to catch the build error.
18 sprintf (buffer, "%" G_GSIZE_FORMAT, a);
31 ptr = GINT_TO_POINTER (iv);
32 iv2 = GPOINTER_TO_INT (ptr);
34 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
37 ptr = GINT_TO_POINTER (iv);
38 iv2 = GPOINTER_TO_INT (ptr);
40 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
43 ptr = GINT_TO_POINTER (iv);
44 iv2 = GPOINTER_TO_INT (ptr);
46 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
49 ptr = GINT_TO_POINTER (iv);
50 iv2 = GPOINTER_TO_INT (ptr);
52 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
55 ptr = GINT_TO_POINTER (iv);
56 iv2 = GPOINTER_TO_INT (ptr);
58 return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
61 ptr = GUINT_TO_POINTER (iv);
62 uv2 = GPOINTER_TO_UINT (ptr);
64 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
67 ptr = GUINT_TO_POINTER (iv);
68 uv2 = GPOINTER_TO_UINT (ptr);
70 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
73 ptr = GUINT_TO_POINTER (iv);
74 uv2 = GPOINTER_TO_UINT (ptr);
76 return FAILED ("uint to pointer and back conversions fail %u != %d", iv, iv2);
90 if (G_STRUCT_OFFSET (my_struct, a) != 0)
91 return FAILED ("offset of a is not zero");
93 if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
94 return FAILED ("offset of b is 4 or 8, macro might be busted");
99 static Test size_tests [] = {
100 {"formats", test_formats},
101 {"ptrconv", test_ptrconv},
102 {"g_struct_offset", test_offset},
106 DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)