1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GLib Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 #undef G_DISABLE_ASSERT
34 sum_up (gpointer data
,
37 gint
*sum
= (gint
*)user_data
;
39 *sum
+= GPOINTER_TO_INT (data
);
49 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
50 for (i
= 0; i
< 10000; i
++)
51 g_array_append_val (garray
, i
);
53 for (i
= 0; i
< 10000; i
++)
54 g_assert_cmpint (g_array_index (garray
, gint
, i
), ==, i
);
56 segment
= (gint
*)g_array_free (garray
, FALSE
);
57 for (i
= 0; i
< 10000; i
++)
58 g_assert_cmpint (segment
[i
], ==, i
);
68 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
69 for (i
= 0; i
< 100; i
++)
70 g_array_prepend_val (garray
, i
);
72 for (i
= 0; i
< 100; i
++)
73 g_assert_cmpint (g_array_index (garray
, gint
, i
), ==, (100 - i
- 1));
75 g_array_free (garray
, TRUE
);
85 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
86 for (i
= 0; i
< 100; i
++)
87 g_array_append_val (garray
, i
);
89 g_assert_cmpint (garray
->len
, ==, 100);
91 g_array_remove_index (garray
, 1);
92 g_array_remove_index (garray
, 3);
93 g_array_remove_index (garray
, 21);
94 g_array_remove_index (garray
, 57);
96 g_assert_cmpint (garray
->len
, ==, 96);
99 for (i
= 0; i
< garray
->len
; i
++)
101 cur
= g_array_index (garray
, gint
, i
);
102 g_assert (cur
!= 1 && cur
!= 4 && cur
!= 23 && cur
!= 60);
103 g_assert_cmpint (prev
, <, cur
);
107 g_array_free (garray
, TRUE
);
111 array_remove_fast (void)
117 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
118 for (i
= 0; i
< 100; i
++)
119 g_array_append_val (garray
, i
);
121 g_assert_cmpint (garray
->len
, ==, 100);
123 g_array_remove_index_fast (garray
, 1);
124 g_array_remove_index_fast (garray
, 3);
125 g_array_remove_index_fast (garray
, 21);
126 g_array_remove_index_fast (garray
, 57);
128 g_assert_cmpint (garray
->len
, ==, 96);
131 for (i
= 0; i
< garray
->len
; i
++)
133 cur
= g_array_index (garray
, gint
, i
);
134 g_assert (cur
!= 1 && cur
!= 3 && cur
!= 21 && cur
!= 57);
137 g_assert_cmpint (prev
, <, cur
);
142 g_array_free (garray
, TRUE
);
146 array_remove_range (void)
152 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
153 for (i
= 0; i
< 100; i
++)
154 g_array_append_val (garray
, i
);
156 g_assert_cmpint (garray
->len
, ==, 100);
158 g_array_remove_range (garray
, 31, 4);
160 g_assert_cmpint (garray
->len
, ==, 96);
163 for (i
= 0; i
< garray
->len
; i
++)
165 cur
= g_array_index (garray
, gint
, i
);
166 g_assert (cur
< 31 || cur
> 34);
167 g_assert_cmpint (prev
, <, cur
);
171 /* Ensure the entire array can be cleared, even when empty. */
172 g_array_remove_range (garray
, 0, garray
->len
);
173 g_array_remove_range (garray
, 0, garray
->len
);
175 g_array_free (garray
, TRUE
);
179 array_ref_count (void)
185 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
186 g_assert_cmpint (g_array_get_element_size (garray
), ==, sizeof (gint
));
187 for (i
= 0; i
< 100; i
++)
188 g_array_prepend_val (garray
, i
);
190 /* check we can ref, unref and still access the array */
191 garray2
= g_array_ref (garray
);
192 g_assert (garray
== garray2
);
193 g_array_unref (garray2
);
194 for (i
= 0; i
< 100; i
++)
195 g_assert_cmpint (g_array_index (garray
, gint
, i
), ==, (100 - i
- 1));
197 /* garray2 should be an empty valid GArray wrapper */
198 garray2
= g_array_ref (garray
);
199 g_array_free (garray
, TRUE
);
201 g_assert_cmpint (garray2
->len
, ==, 0);
202 g_array_unref (garray2
);
206 int_compare (gconstpointer p1
, gconstpointer p2
)
215 int_compare_data (gconstpointer p1
, gconstpointer p2
, gpointer data
)
229 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
230 for (i
= 0; i
< 10000; i
++)
232 cur
= g_random_int_range (0, 10000);
233 g_array_append_val (garray
, cur
);
235 g_array_sort (garray
, int_compare
);
238 for (i
= 0; i
< garray
->len
; i
++)
240 cur
= g_array_index (garray
, gint
, i
);
241 g_assert_cmpint (prev
, <=, cur
);
245 g_array_free (garray
, TRUE
);
249 array_sort_with_data (void)
255 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
256 for (i
= 0; i
< 10000; i
++)
258 cur
= g_random_int_range (0, 10000);
259 g_array_append_val (garray
, cur
);
261 g_array_sort_with_data (garray
, int_compare_data
, NULL
);
264 for (i
= 0; i
< garray
->len
; i
++)
266 cur
= g_array_index (garray
, gint
, i
);
267 g_assert_cmpint (prev
, <=, cur
);
271 g_array_free (garray
, TRUE
);
274 static gint num_clear_func_invocations
= 0;
277 my_clear_func (gpointer data
)
279 num_clear_func_invocations
+= 1;
283 array_clear_func (void)
289 garray
= g_array_new (FALSE
, FALSE
, sizeof (gint
));
290 g_array_set_clear_func (garray
, my_clear_func
);
292 for (i
= 0; i
< 10; i
++)
294 cur
= g_random_int_range (0, 100);
295 g_array_append_val (garray
, cur
);
298 g_array_remove_index (garray
, 9);
299 g_assert_cmpint (num_clear_func_invocations
, ==, 1);
301 g_array_remove_range (garray
, 5, 3);
302 g_assert_cmpint (num_clear_func_invocations
, ==, 4);
304 g_array_remove_index_fast (garray
, 4);
305 g_assert_cmpint (num_clear_func_invocations
, ==, 5);
307 g_array_free (garray
, TRUE
);
308 g_assert_cmpint (num_clear_func_invocations
, ==, 10);
312 pointer_array_add (void)
319 gparray
= g_ptr_array_sized_new (1000);
321 for (i
= 0; i
< 10000; i
++)
322 g_ptr_array_add (gparray
, GINT_TO_POINTER (i
));
324 for (i
= 0; i
< 10000; i
++)
325 g_assert (g_ptr_array_index (gparray
, i
) == GINT_TO_POINTER (i
));
327 g_ptr_array_foreach (gparray
, sum_up
, &sum
);
328 g_assert (sum
== 49995000);
330 segment
= g_ptr_array_free (gparray
, FALSE
);
331 for (i
= 0; i
< 10000; i
++)
332 g_assert (segment
[i
] == GINT_TO_POINTER (i
));
337 pointer_array_insert (void)
344 gparray
= g_ptr_array_sized_new (1000);
346 for (i
= 0; i
< 10000; i
++)
348 index
= g_random_int_range (-1, i
+ 1);
349 g_ptr_array_insert (gparray
, index
, GINT_TO_POINTER (i
));
352 g_ptr_array_foreach (gparray
, sum_up
, &sum
);
353 g_assert (sum
== 49995000);
355 g_ptr_array_free (gparray
, TRUE
);
359 pointer_array_ref_count (void)
366 gparray
= g_ptr_array_new ();
367 for (i
= 0; i
< 10000; i
++)
368 g_ptr_array_add (gparray
, GINT_TO_POINTER (i
));
370 /* check we can ref, unref and still access the array */
371 gparray2
= g_ptr_array_ref (gparray
);
372 g_assert (gparray
== gparray2
);
373 g_ptr_array_unref (gparray2
);
374 for (i
= 0; i
< 10000; i
++)
375 g_assert (g_ptr_array_index (gparray
, i
) == GINT_TO_POINTER (i
));
377 g_ptr_array_foreach (gparray
, sum_up
, &sum
);
378 g_assert (sum
== 49995000);
380 /* gparray2 should be an empty valid GPtrArray wrapper */
381 gparray2
= g_ptr_array_ref (gparray
);
382 g_ptr_array_free (gparray
, TRUE
);
384 g_assert_cmpint (gparray2
->len
, ==, 0);
385 g_ptr_array_unref (gparray2
);
388 static gint num_free_func_invocations
= 0;
391 my_free_func (gpointer data
)
393 num_free_func_invocations
++;
398 pointer_array_free_func (void)
405 num_free_func_invocations
= 0;
406 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
407 g_ptr_array_unref (gparray
);
408 g_assert_cmpint (num_free_func_invocations
, ==, 0);
410 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
411 g_ptr_array_free (gparray
, TRUE
);
412 g_assert_cmpint (num_free_func_invocations
, ==, 0);
414 num_free_func_invocations
= 0;
415 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
416 g_ptr_array_add (gparray
, g_strdup ("foo"));
417 g_ptr_array_add (gparray
, g_strdup ("bar"));
418 g_ptr_array_add (gparray
, g_strdup ("baz"));
419 g_ptr_array_remove_index (gparray
, 0);
420 g_assert_cmpint (num_free_func_invocations
, ==, 1);
421 g_ptr_array_remove_index_fast (gparray
, 1);
422 g_assert_cmpint (num_free_func_invocations
, ==, 2);
423 s
= g_strdup ("frob");
424 g_ptr_array_add (gparray
, s
);
425 g_assert (g_ptr_array_remove (gparray
, s
));
426 g_assert (!g_ptr_array_remove (gparray
, "nuun"));
427 g_assert (!g_ptr_array_remove_fast (gparray
, "mlo"));
428 g_assert_cmpint (num_free_func_invocations
, ==, 3);
429 s
= g_strdup ("frob");
430 g_ptr_array_add (gparray
, s
);
431 g_ptr_array_set_size (gparray
, 1);
432 g_assert_cmpint (num_free_func_invocations
, ==, 4);
433 g_ptr_array_ref (gparray
);
434 g_ptr_array_unref (gparray
);
435 g_assert_cmpint (num_free_func_invocations
, ==, 4);
436 g_ptr_array_unref (gparray
);
437 g_assert_cmpint (num_free_func_invocations
, ==, 5);
439 num_free_func_invocations
= 0;
440 gparray
= g_ptr_array_new_full (10, my_free_func
);
441 g_ptr_array_add (gparray
, g_strdup ("foo"));
442 g_ptr_array_add (gparray
, g_strdup ("bar"));
443 g_ptr_array_add (gparray
, g_strdup ("baz"));
444 g_ptr_array_set_size (gparray
, 20);
445 g_ptr_array_add (gparray
, NULL
);
446 gparray2
= g_ptr_array_ref (gparray
);
447 strv
= (gchar
**) g_ptr_array_free (gparray
, FALSE
);
448 g_assert_cmpint (num_free_func_invocations
, ==, 0);
450 g_ptr_array_unref (gparray2
);
451 g_assert_cmpint (num_free_func_invocations
, ==, 0);
453 num_free_func_invocations
= 0;
454 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
455 g_ptr_array_add (gparray
, g_strdup ("foo"));
456 g_ptr_array_add (gparray
, g_strdup ("bar"));
457 g_ptr_array_add (gparray
, g_strdup ("baz"));
458 g_ptr_array_remove_range (gparray
, 1, 1);
459 g_ptr_array_unref (gparray
);
460 g_assert_cmpint (num_free_func_invocations
, ==, 3);
462 num_free_func_invocations
= 0;
463 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
464 g_ptr_array_add (gparray
, g_strdup ("foo"));
465 g_ptr_array_add (gparray
, g_strdup ("bar"));
466 g_ptr_array_add (gparray
, g_strdup ("baz"));
467 g_ptr_array_free (gparray
, TRUE
);
468 g_assert_cmpint (num_free_func_invocations
, ==, 3);
470 num_free_func_invocations
= 0;
471 gparray
= g_ptr_array_new_with_free_func (my_free_func
);
472 g_ptr_array_add (gparray
, "foo");
473 g_ptr_array_add (gparray
, "bar");
474 g_ptr_array_add (gparray
, "baz");
475 g_ptr_array_set_free_func (gparray
, NULL
);
476 g_ptr_array_free (gparray
, TRUE
);
477 g_assert_cmpint (num_free_func_invocations
, ==, 0);
481 ptr_compare (gconstpointer p1
, gconstpointer p2
)
483 gpointer i1
= *(gpointer
*)p1
;
484 gpointer i2
= *(gpointer
*)p2
;
486 return GPOINTER_TO_INT (i1
) - GPOINTER_TO_INT (i2
);
490 ptr_compare_data (gconstpointer p1
, gconstpointer p2
, gpointer data
)
492 gpointer i1
= *(gpointer
*)p1
;
493 gpointer i2
= *(gpointer
*)p2
;
495 return GPOINTER_TO_INT (i1
) - GPOINTER_TO_INT (i2
);
499 pointer_array_sort (void)
506 gparray
= g_ptr_array_new ();
507 for (i
= 0; i
< 10000; i
++)
509 val
= g_random_int_range (0, 10000);
510 g_ptr_array_add (gparray
, GINT_TO_POINTER (val
));
513 g_ptr_array_sort (gparray
, ptr_compare
);
516 for (i
= 0; i
< 10000; i
++)
518 cur
= GPOINTER_TO_INT (g_ptr_array_index (gparray
, i
));
519 g_assert_cmpint (prev
, <=, cur
);
523 g_ptr_array_free (gparray
, TRUE
);
527 pointer_array_sort_with_data (void)
533 gparray
= g_ptr_array_new ();
534 for (i
= 0; i
< 10000; i
++)
535 g_ptr_array_add (gparray
, GINT_TO_POINTER (g_random_int_range (0, 10000)));
537 g_ptr_array_sort_with_data (gparray
, ptr_compare_data
, NULL
);
540 for (i
= 0; i
< 10000; i
++)
542 cur
= GPOINTER_TO_INT (g_ptr_array_index (gparray
, i
));
543 g_assert_cmpint (prev
, <=, cur
);
547 g_ptr_array_free (gparray
, TRUE
);
551 byte_array_append (void)
557 gbarray
= g_byte_array_sized_new (1000);
558 for (i
= 0; i
< 10000; i
++)
559 g_byte_array_append (gbarray
, (guint8
*) "abcd", 4);
561 for (i
= 0; i
< 10000; i
++)
563 g_assert (gbarray
->data
[4*i
] == 'a');
564 g_assert (gbarray
->data
[4*i
+1] == 'b');
565 g_assert (gbarray
->data
[4*i
+2] == 'c');
566 g_assert (gbarray
->data
[4*i
+3] == 'd');
569 segment
= g_byte_array_free (gbarray
, FALSE
);
571 for (i
= 0; i
< 10000; i
++)
573 g_assert (segment
[4*i
] == 'a');
574 g_assert (segment
[4*i
+1] == 'b');
575 g_assert (segment
[4*i
+2] == 'c');
576 g_assert (segment
[4*i
+3] == 'd');
583 byte_array_prepend (void)
588 gbarray
= g_byte_array_new ();
589 g_byte_array_set_size (gbarray
, 1000);
591 for (i
= 0; i
< 10000; i
++)
592 g_byte_array_prepend (gbarray
, (guint8
*) "abcd", 4);
594 for (i
= 0; i
< 10000; i
++)
596 g_assert (gbarray
->data
[4*i
] == 'a');
597 g_assert (gbarray
->data
[4*i
+1] == 'b');
598 g_assert (gbarray
->data
[4*i
+2] == 'c');
599 g_assert (gbarray
->data
[4*i
+3] == 'd');
602 g_byte_array_free (gbarray
, TRUE
);
606 byte_array_ref_count (void)
609 GByteArray
*gbarray2
;
612 gbarray
= g_byte_array_new ();
613 for (i
= 0; i
< 10000; i
++)
614 g_byte_array_append (gbarray
, (guint8
*) "abcd", 4);
616 gbarray2
= g_byte_array_ref (gbarray
);
617 g_assert (gbarray2
== gbarray
);
618 g_byte_array_unref (gbarray2
);
619 for (i
= 0; i
< 10000; i
++)
621 g_assert (gbarray
->data
[4*i
] == 'a');
622 g_assert (gbarray
->data
[4*i
+1] == 'b');
623 g_assert (gbarray
->data
[4*i
+2] == 'c');
624 g_assert (gbarray
->data
[4*i
+3] == 'd');
627 gbarray2
= g_byte_array_ref (gbarray
);
628 g_assert (gbarray2
== gbarray
);
629 g_byte_array_free (gbarray
, TRUE
);
630 g_assert_cmpint (gbarray2
->len
, ==, 0);
631 g_byte_array_unref (gbarray2
);
635 byte_array_remove (void)
640 gbarray
= g_byte_array_new ();
641 for (i
= 0; i
< 100; i
++)
642 g_byte_array_append (gbarray
, (guint8
*) "abcd", 4);
644 g_assert_cmpint (gbarray
->len
, ==, 400);
646 g_byte_array_remove_index (gbarray
, 4);
647 g_byte_array_remove_index (gbarray
, 4);
648 g_byte_array_remove_index (gbarray
, 4);
649 g_byte_array_remove_index (gbarray
, 4);
651 g_assert_cmpint (gbarray
->len
, ==, 396);
653 for (i
= 0; i
< 99; i
++)
655 g_assert (gbarray
->data
[4*i
] == 'a');
656 g_assert (gbarray
->data
[4*i
+1] == 'b');
657 g_assert (gbarray
->data
[4*i
+2] == 'c');
658 g_assert (gbarray
->data
[4*i
+3] == 'd');
661 g_byte_array_free (gbarray
, TRUE
);
665 byte_array_remove_fast (void)
670 gbarray
= g_byte_array_new ();
671 for (i
= 0; i
< 100; i
++)
672 g_byte_array_append (gbarray
, (guint8
*) "abcd", 4);
674 g_assert_cmpint (gbarray
->len
, ==, 400);
676 g_byte_array_remove_index_fast (gbarray
, 4);
677 g_byte_array_remove_index_fast (gbarray
, 4);
678 g_byte_array_remove_index_fast (gbarray
, 4);
679 g_byte_array_remove_index_fast (gbarray
, 4);
681 g_assert_cmpint (gbarray
->len
, ==, 396);
683 for (i
= 0; i
< 99; i
++)
685 g_assert (gbarray
->data
[4*i
] == 'a');
686 g_assert (gbarray
->data
[4*i
+1] == 'b');
687 g_assert (gbarray
->data
[4*i
+2] == 'c');
688 g_assert (gbarray
->data
[4*i
+3] == 'd');
691 g_byte_array_free (gbarray
, TRUE
);
695 byte_array_remove_range (void)
700 gbarray
= g_byte_array_new ();
701 for (i
= 0; i
< 100; i
++)
702 g_byte_array_append (gbarray
, (guint8
*) "abcd", 4);
704 g_assert_cmpint (gbarray
->len
, ==, 400);
706 g_byte_array_remove_range (gbarray
, 12, 4);
708 g_assert_cmpint (gbarray
->len
, ==, 396);
710 for (i
= 0; i
< 99; i
++)
712 g_assert (gbarray
->data
[4*i
] == 'a');
713 g_assert (gbarray
->data
[4*i
+1] == 'b');
714 g_assert (gbarray
->data
[4*i
+2] == 'c');
715 g_assert (gbarray
->data
[4*i
+3] == 'd');
718 /* Ensure the entire array can be cleared, even when empty. */
719 g_byte_array_remove_range (gbarray
, 0, gbarray
->len
);
720 g_byte_array_remove_range (gbarray
, 0, gbarray
->len
);
722 g_byte_array_free (gbarray
, TRUE
);
726 byte_compare (gconstpointer p1
, gconstpointer p2
)
728 const guint8
*i1
= p1
;
729 const guint8
*i2
= p2
;
735 byte_compare_data (gconstpointer p1
, gconstpointer p2
, gpointer data
)
737 const guint8
*i1
= p1
;
738 const guint8
*i2
= p2
;
744 byte_array_sort (void)
751 gbarray
= g_byte_array_new ();
752 for (i
= 0; i
< 100; i
++)
754 val
= 'a' + g_random_int_range (0, 26);
755 g_byte_array_append (gbarray
, (guint8
*) &val
, 1);
758 g_byte_array_sort (gbarray
, byte_compare
);
761 for (i
= 0; i
< gbarray
->len
; i
++)
763 cur
= gbarray
->data
[i
];
764 g_assert_cmpint (prev
, <=, cur
);
768 g_byte_array_free (gbarray
, TRUE
);
772 byte_array_sort_with_data (void)
779 gbarray
= g_byte_array_new ();
780 for (i
= 0; i
< 100; i
++)
782 val
= 'a' + g_random_int_range (0, 26);
783 g_byte_array_append (gbarray
, (guint8
*) &val
, 1);
786 g_byte_array_sort_with_data (gbarray
, byte_compare_data
, NULL
);
789 for (i
= 0; i
< gbarray
->len
; i
++)
791 cur
= gbarray
->data
[i
];
792 g_assert_cmpint (prev
, <=, cur
);
796 g_byte_array_free (gbarray
, TRUE
);
800 byte_array_new_take (void)
805 data
= g_memdup ("woooweeewow", 11);
806 gbarray
= g_byte_array_new_take (data
, 11);
807 g_assert (gbarray
->data
== data
);
808 g_assert_cmpuint (gbarray
->len
, ==, 11);
809 g_byte_array_free (gbarray
, TRUE
);
813 byte_array_free_to_bytes (void)
820 gbarray
= g_byte_array_new ();
821 g_byte_array_append (gbarray
, (guint8
*)"woooweeewow", 11);
822 memory
= gbarray
->data
;
824 bytes
= g_byte_array_free_to_bytes (gbarray
);
825 g_assert (bytes
!= NULL
);
826 g_assert_cmpuint (g_bytes_get_size (bytes
), ==, 11);
827 g_assert (g_bytes_get_data (bytes
, &size
) == memory
);
828 g_assert_cmpuint (size
, ==, 11);
830 g_bytes_unref (bytes
);
833 main (int argc
, char *argv
[])
835 g_test_init (&argc
, &argv
, NULL
);
837 g_test_bug_base ("http://bugs.gnome.org/");
840 g_test_add_func ("/array/append", array_append
);
841 g_test_add_func ("/array/prepend", array_prepend
);
842 g_test_add_func ("/array/remove", array_remove
);
843 g_test_add_func ("/array/remove-fast", array_remove_fast
);
844 g_test_add_func ("/array/remove-range", array_remove_range
);
845 g_test_add_func ("/array/ref-count", array_ref_count
);
846 g_test_add_func ("/array/sort", array_sort
);
847 g_test_add_func ("/array/sort-with-data", array_sort_with_data
);
848 g_test_add_func ("/array/clear-func", array_clear_func
);
851 g_test_add_func ("/pointerarray/add", pointer_array_add
);
852 g_test_add_func ("/pointerarray/insert", pointer_array_insert
);
853 g_test_add_func ("/pointerarray/ref-count", pointer_array_ref_count
);
854 g_test_add_func ("/pointerarray/free-func", pointer_array_free_func
);
855 g_test_add_func ("/pointerarray/sort", pointer_array_sort
);
856 g_test_add_func ("/pointerarray/sort-with-data", pointer_array_sort_with_data
);
859 g_test_add_func ("/bytearray/append", byte_array_append
);
860 g_test_add_func ("/bytearray/prepend", byte_array_prepend
);
861 g_test_add_func ("/bytearray/remove", byte_array_remove
);
862 g_test_add_func ("/bytearray/remove-fast", byte_array_remove_fast
);
863 g_test_add_func ("/bytearray/remove-range", byte_array_remove_range
);
864 g_test_add_func ("/bytearray/ref-count", byte_array_ref_count
);
865 g_test_add_func ("/bytearray/sort", byte_array_sort
);
866 g_test_add_func ("/bytearray/sort-with-data", byte_array_sort_with_data
);
867 g_test_add_func ("/bytearray/new-take", byte_array_new_take
);
868 g_test_add_func ("/bytearray/free-to-bytes", byte_array_free_to_bytes
);
870 return g_test_run ();