Debian Codegraph @

testsuite/gtk/treepath.c

raw symbols SCIP
1 /* GtkTreePath tests.
2 *
3 * Copyright (C) 2011, Red Hat, Inc.
4 * Authors: Matthias Clasen <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <gtk/gtk.h>cxx . . $ `<file>/gtk/gtk.h`/
21
22 G_GNUC_BEGIN_IGNORE_DEPRECATIONScxx . . $ `<external>/12741050725406041920/gmacros.h:771:9`!
23
24 static void
25 test_appendcxx . . $ test_append(49f6e7a06ebc5aa8). (void)
26 {
27 GtkTreePathcxx . . $ GtkTreePath# *p;
28 int i;
29 int *indices;
30
31 p = gtk_tree_path_newcxx . . $ gtk_tree_path_new(90b9ac7cbb03904b). ();
32 for (i = 0; i < 100; i++)
33 {
34 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (p), ==, i);
35 gtk_tree_path_append_indexcxx . . $ gtk_tree_path_append_index(3896e6308d8ef8d9). (p, i);
36 }
37
38 indices = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (p);
39 for (i = 0; i < 100; i++)
40 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (indices[i], ==, i);
41
42 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
43 }
44
45 static void
46 test_prependcxx . . $ test_prepend(49f6e7a06ebc5aa8). (void)
47 {
48 GtkTreePathcxx . . $ GtkTreePath# *p;
49 int i;
50 int *indices;
51
52 p = gtk_tree_path_newcxx . . $ gtk_tree_path_new(90b9ac7cbb03904b). ();
53 for (i = 0; i < 100; i++)
54 {
55 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (p), ==, i);
56 gtk_tree_path_prepend_indexcxx . . $ gtk_tree_path_prepend_index(3896e6308d8ef8d9). (p, i);
57 }
58
59 indices = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (p);
60 for (i = 0; i < 100; i++)
61 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (indices[i], ==, 99 - i);
62
63 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
64 }
65
66 static void
67 test_to_stringcxx . . $ test_to_string(49f6e7a06ebc5aa8). (void)
68 {
69 const char *str = "0:1:2:3:4:5:6:7:8:9:10";
70 GtkTreePathcxx . . $ GtkTreePath# *p;
71 int *indices;
72 char *s;
73 int i;
74
75 p = gtk_tree_path_new_from_stringcxx . . $ gtk_tree_path_new_from_string(8d4ba14421d67beb). (str);
76 indices = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (p);
77 for (i = 0; i < 10; i++)
78 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (indices[i], ==, i);
79 s = gtk_tree_path_to_stringcxx . . $ gtk_tree_path_to_string(185e37f3568734df). (p);
80 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (s, ==, str);
81
82 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
83 g_freecxx . . $ g_free(5d22bdacc48458e8). (s);
84 }
85
86 static void
87 test_from_indicescxx . . $ test_from_indices(49f6e7a06ebc5aa8). (void)
88 {
89 GtkTreePathcxx . . $ GtkTreePath# *p;
90 int *indices;
91 int i;
92
93 p = gtk_tree_path_new_from_indicescxx . . $ gtk_tree_path_new_from_indices(2b01490840d77a48). (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
94 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (p), ==, 10);
95 indices = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (p);
96 for (i = 0; i < 10; i++)
97 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (indices[i], ==, i);
98 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
99 }
100
101 static void
102 test_firstcxx . . $ test_first(49f6e7a06ebc5aa8). (void)
103 {
104 GtkTreePathcxx . . $ GtkTreePath# *p;
105 p = gtk_tree_path_new_firstcxx . . $ gtk_tree_path_new_first(90b9ac7cbb03904b). ();
106 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (p), ==, 1);
107 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_indices (p)[0], ==, 0);
108 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
109 }
110
111 static void
112 test_navigationcxx . . $ test_navigation(49f6e7a06ebc5aa8). (void)
113 {
114 GtkTreePathcxx . . $ GtkTreePath# *p;
115 GtkTreePathcxx . . $ GtkTreePath# *q;
116 int *pi;
117 int *qi;
118 int i;
119 gbooleancxx . . $ gboolean# res;
120
121 p = gtk_tree_path_new_from_indicescxx . . $ gtk_tree_path_new_from_indices(2b01490840d77a48). (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1);
122 q = gtk_tree_path_copycxx . . $ gtk_tree_path_copy(e954354b3137d9be). (p);
123 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_compare (p, q) == 0);
124 gtk_tree_path_nextcxx . . $ gtk_tree_path_next(ddbfee6baabe5bde). (q);
125 pi = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (p);
126 qi = gtk_tree_path_get_indicescxx . . $ gtk_tree_path_get_indices(4ba7fe52d8d5a4a2). (q);
127 for (i = 0; i < 9; i++)
128 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (pi[i], ==, qi[i]);
129 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (qi[9], ==, pi[9] + 1);
130
131 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_ancestor (p, q));
132 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_ancestor (q, p));
133 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_descendant (p, q));
134 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_descendant (q, p));
135
136 res = gtk_tree_path_prevcxx . . $ gtk_tree_path_prev(3faab4844ef0c3db). (q);
137 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (res);
138 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_compare (p, q) == 0);
139
140 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_ancestor (p, q));
141 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_ancestor (q, p));
142 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_descendant (p, q));
143 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_descendant (q, p));
144
145 gtk_tree_path_downcxx . . $ gtk_tree_path_down(ddbfee6baabe5bde). (q);
146
147 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_compare (p, q) < 0);
148
149 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_is_ancestor (p, q));
150 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_ancestor (q, p));
151 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (gtk_tree_path_is_descendant (p, q));
152 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_is_descendant (q, p));
153
154 res = gtk_tree_path_prevcxx . . $ gtk_tree_path_prev(3faab4844ef0c3db). (q);
155 g_assert_falsecxx . . $ `<external>/15287032793271088244/gtestutils.h:232:9`! (res);
156
157 res = gtk_tree_path_upcxx . . $ gtk_tree_path_up(3faab4844ef0c3db). (q);
158 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (res);
159 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gtk_tree_path_compare (p, q) == 0);
160
161 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (q), ==, 10);
162 res = gtk_tree_path_upcxx . . $ gtk_tree_path_up(3faab4844ef0c3db). (q);
163 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (res);
164 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (gtk_tree_path_get_depth (q), ==, 9);
165
166 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (p);
167 gtk_tree_path_freecxx . . $ gtk_tree_path_free(ddbfee6baabe5bde). (q);
168 }
169
170 int
171 maincxx . . $ main(afcd3168fc1188a4). (int argc, char *argv[])
172 {
173 gtk_test_initcxx . . $ gtk_test_init(b91bcc5cc1349d78). (&argc, &argv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
174
175 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/append", test_appendcxx . . $ test_append(49f6e7a06ebc5aa8).);
176 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/prepend", test_prependcxx . . $ test_prepend(49f6e7a06ebc5aa8).);
177 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/to-string", test_to_stringcxx . . $ test_to_string(49f6e7a06ebc5aa8).);
178 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/from-indices", test_from_indicescxx . . $ test_from_indices(49f6e7a06ebc5aa8).);
179 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/first", test_firstcxx . . $ test_first(49f6e7a06ebc5aa8).);
180 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/tree-path/navigation", test_navigationcxx . . $ test_navigation(49f6e7a06ebc5aa8).);
181
182 return g_test_runcxx . . $ g_test_run(b126dc7c1de90089). ();
183 }