File: | testsuite/cdk/rectangle.c |
Warning: | line 38, column 3 Value stored to 'res' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <cdk/cdk.h> |
2 | |
3 | static void |
4 | test_rectangle_equal (void) |
5 | { |
6 | CdkRectangle a = { 0, 0, 1, 1 }; |
7 | CdkRectangle b = { 1, 1, 2, 2 }; |
8 | CdkRectangle c = { 0, 0, 2, 2 }; |
9 | CdkRectangle d = { 0, 0, 1, 1 }; |
10 | CdkRectangle e = { 0, 0, 0, 0 }; |
11 | CdkRectangle f = { 1, 1, 0, 0 }; |
12 | |
13 | g_assert_true (!cdk_rectangle_equal (&a, &b))do { if (!cdk_rectangle_equal (&a, &b)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 13, ((const char*) (__func__)) , "'" "!cdk_rectangle_equal (&a, &b)" "' should be TRUE" ); } while (0); |
14 | g_assert_true (!cdk_rectangle_equal (&a, &c))do { if (!cdk_rectangle_equal (&a, &c)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 14, ((const char*) (__func__)) , "'" "!cdk_rectangle_equal (&a, &c)" "' should be TRUE" ); } while (0); |
15 | g_assert_true (!cdk_rectangle_equal (&b, &c))do { if (!cdk_rectangle_equal (&b, &c)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 15, ((const char*) (__func__)) , "'" "!cdk_rectangle_equal (&b, &c)" "' should be TRUE" ); } while (0); |
16 | g_assert_true ( cdk_rectangle_equal (&a, &d))do { if (cdk_rectangle_equal (&a, &d)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 16, ((const char*) (__func__)) , "'" "cdk_rectangle_equal (&a, &d)" "' should be TRUE" ); } while (0); |
17 | g_assert_true (!cdk_rectangle_equal (&e, &f))do { if (!cdk_rectangle_equal (&e, &f)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 17, ((const char*) (__func__)) , "'" "!cdk_rectangle_equal (&e, &f)" "' should be TRUE" ); } while (0); |
18 | } |
19 | |
20 | static void |
21 | test_rectangle_intersect (void) |
22 | { |
23 | CdkRectangle a = { 0, 0, 10, 10 }; |
24 | CdkRectangle b = { 5, 5, 10, 10 }; |
25 | CdkRectangle c = { 0, 0, 0, 0 }; |
26 | CdkRectangle d = { 5, 5, 5, 5 }; |
27 | CdkRectangle e = { 0, 0, 10, 10 }; |
28 | CdkRectangle f = { 20, 20, 10, 10 }; |
29 | CdkRectangle g = { 0, 0, 0, 0 }; |
30 | CdkRectangle h = { 10, 10, 0, 0 }; |
31 | gboolean res; |
32 | |
33 | res = cdk_rectangle_intersect (&a, &b, &c); |
34 | g_assert_true (res)do { if (res) ; else g_assertion_message (((gchar*) 0), "rectangle.c" , 34, ((const char*) (__func__)), "'" "res" "' should be TRUE" ); } while (0); |
35 | g_assert_true (cdk_rectangle_equal (&c, &d))do { if (cdk_rectangle_equal (&c, &d)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 35, ((const char*) (__func__)) , "'" "cdk_rectangle_equal (&c, &d)" "' should be TRUE" ); } while (0); |
36 | |
37 | /* non-empty, non-intersecting rectangles */ |
38 | res = cdk_rectangle_intersect (&e, &f, &f); |
Value stored to 'res' is never read | |
39 | g_assert_cmpint (f.width, ==, 0)do { gint64 __n1 = (f.width), __n2 = (0); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0), "rectangle.c" , 39, ((const char*) (__func__)), "f.width" " " "==" " " "0", (guint64)__n1, "==", (guint64)__n2, 'i'); } while (0); |
40 | g_assert_cmpint (f.height, ==, 0)do { gint64 __n1 = (f.height), __n2 = (0); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0), "rectangle.c" , 40, ((const char*) (__func__)), "f.height" " " "==" " " "0" , (guint64)__n1, "==", (guint64)__n2, 'i'); } while (0); |
41 | |
42 | /* empty rectangles */ |
43 | res = cdk_rectangle_intersect (&g, &h, NULL((void*)0)); |
44 | g_assert_true (!res)do { if (!res) ; else g_assertion_message (((gchar*) 0), "rectangle.c" , 44, ((const char*) (__func__)), "'" "!res" "' should be TRUE" ); } while (0); |
45 | } |
46 | |
47 | static void |
48 | test_rectangle_union (void) |
49 | { |
50 | CdkRectangle a = { 0, 0, 10, 10 }; |
51 | CdkRectangle b = { 5, 5, 10, 10 }; |
52 | CdkRectangle c = { 0, 0, 0, 0 }; |
53 | CdkRectangle d = { 0, 0, 15, 15 }; |
54 | CdkRectangle e = { 0, 0, 0, 0 }; |
55 | CdkRectangle f = { 50, 50, 0, 0 }; |
56 | CdkRectangle g = { 0, 0, 50, 50 }; |
57 | |
58 | cdk_rectangle_union (&a, &b, &c); |
59 | g_assert_true (cdk_rectangle_equal (&c, &d))do { if (cdk_rectangle_equal (&c, &d)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 59, ((const char*) (__func__)) , "'" "cdk_rectangle_equal (&c, &d)" "' should be TRUE" ); } while (0); |
60 | |
61 | cdk_rectangle_union (&a, &b, &b); |
62 | g_assert_true (cdk_rectangle_equal (&b, &d))do { if (cdk_rectangle_equal (&b, &d)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 62, ((const char*) (__func__)) , "'" "cdk_rectangle_equal (&b, &d)" "' should be TRUE" ); } while (0); |
63 | |
64 | cdk_rectangle_union (&e, &f, &f); |
65 | g_assert_true (cdk_rectangle_equal (&f, &g))do { if (cdk_rectangle_equal (&f, &g)) ; else g_assertion_message (((gchar*) 0), "rectangle.c", 65, ((const char*) (__func__)) , "'" "cdk_rectangle_equal (&f, &g)" "' should be TRUE" ); } while (0); |
66 | } |
67 | |
68 | int |
69 | main (int argc, char *argv[]) |
70 | { |
71 | g_test_init (&argc, &argv, NULL((void*)0)); |
72 | |
73 | cdk_init (NULL((void*)0), NULL((void*)0)); |
74 | |
75 | g_test_bug_base ("http://bugzilla.gnome.org/"); |
76 | |
77 | g_test_add_func ("/rectangle/equal", test_rectangle_equal); |
78 | g_test_add_func ("/rectangle/intersect", test_rectangle_intersect); |
79 | g_test_add_func ("/rectangle/union", test_rectangle_union); |
80 | |
81 | return g_test_run (); |
82 | } |