2 * Tests to ensure that our type definitions are correct
4 * These depend on -Werror, -Wall being set to catch the build error.
20 sprintf (buffer
, "%" G_GSIZE_FORMAT
, a
);
33 ptr
= GINT_TO_POINTER (iv
);
34 iv2
= GPOINTER_TO_INT (ptr
);
36 return FAILED ("int to pointer and back conversions fail %d != %d", iv
, iv2
);
39 ptr
= GINT_TO_POINTER (iv
);
40 iv2
= GPOINTER_TO_INT (ptr
);
42 return FAILED ("int to pointer and back conversions fail %d != %d", iv
, iv2
);
45 ptr
= GINT_TO_POINTER (iv
);
46 iv2
= GPOINTER_TO_INT (ptr
);
48 return FAILED ("int to pointer and back conversions fail %d != %d", iv
, iv2
);
51 ptr
= GINT_TO_POINTER (iv
);
52 iv2
= GPOINTER_TO_INT (ptr
);
54 return FAILED ("int to pointer and back conversions fail %d != %d", iv
, iv2
);
57 ptr
= GINT_TO_POINTER (iv
);
58 iv2
= GPOINTER_TO_INT (ptr
);
60 return FAILED ("int to pointer and back conversions fail %d != %d", iv
, iv2
);
63 ptr
= GUINT_TO_POINTER (iv
);
64 uv2
= GPOINTER_TO_UINT (ptr
);
66 return FAILED ("uint to pointer and back conversions fail %u != %d", iv
, iv2
);
69 ptr
= GUINT_TO_POINTER (iv
);
70 uv2
= GPOINTER_TO_UINT (ptr
);
72 return FAILED ("uint to pointer and back conversions fail %u != %d", iv
, iv2
);
75 ptr
= GUINT_TO_POINTER (iv
);
76 uv2
= GPOINTER_TO_UINT (ptr
);
78 return FAILED ("uint to pointer and back conversions fail %u != %d", iv
, iv2
);
92 if (G_STRUCT_OFFSET (my_struct
, a
) != 0)
93 return FAILED ("offset of a is not zero");
95 if (G_STRUCT_OFFSET (my_struct
, b
) != 4 && G_STRUCT_OFFSET (my_struct
, b
) != 8)
96 return FAILED ("offset of b is 4 or 8, macro might be busted");
101 static Test size_tests
[] = {
102 {"formats", test_formats
},
103 {"ptrconv", test_ptrconv
},
104 {"g_struct_offset", test_offset
},
108 DEFINE_TEST_GROUP_INIT(size_tests_init
, size_tests
)