1#include <glib.h>
2#include <string.h>
3
4typedef struct _HNVC HasNonVoidCleanup;
5HasNonVoidCleanup * non_void_cleanup (HasNonVoidCleanup *);
6
7/* Should not cause any warnings with -Wextra */
8G_DEFINE_AUTOPTR_CLEANUP_FUNC(HasNonVoidCleanup, non_void_cleanup)
9
10static void
11test_autofree (void)
12{
13#ifdef __clang_analyzer__
14 g_test_skip ("autofree tests aren’t understood by the clang analyser");
15#else
16 g_autofree gchar *p = NULL;
17 g_autofree gchar *p2 = NULL;
18 g_autofree gchar *alwaysnull = NULL;
19
20 p = g_malloc (n_bytes: 10);
21 p2 = g_malloc (n_bytes: 42);
22
23 if (TRUE)
24 {
25 g_autofree guint8 *buf = g_malloc (n_bytes: 128);
26 g_autofree gchar *alwaysnull_again = NULL;
27
28 buf[0] = 1;
29
30 g_assert_null (alwaysnull_again);
31 }
32
33 if (TRUE)
34 {
35 g_autofree guint8 *buf2 = g_malloc (n_bytes: 256);
36
37 buf2[255] = 42;
38 }
39
40 g_assert_null (alwaysnull);
41#endif /* __clang_analyzer__ */
42}
43
44static void
45test_g_async_queue (void)
46{
47 g_autoptr(GAsyncQueue) val = g_async_queue_new ();
48 g_assert_nonnull (val);
49}
50
51static void
52test_g_bookmark_file (void)
53{
54 g_autoptr(GBookmarkFile) val = g_bookmark_file_new ();
55 g_assert_nonnull (val);
56}
57
58static void
59test_g_bytes (void)
60{
61 g_autoptr(GBytes) val = g_bytes_new (data: "foo", size: 3);
62 g_assert_nonnull (val);
63}
64
65static void
66test_g_checksum (void)
67{
68 g_autoptr(GChecksum) val = g_checksum_new (checksum_type: G_CHECKSUM_SHA256);
69 g_assert_nonnull (val);
70}
71
72static void
73test_g_date (void)
74{
75 g_autoptr(GDate) val = g_date_new ();
76 g_assert_nonnull (val);
77}
78
79static void
80test_g_date_time (void)
81{
82 g_autoptr(GDateTime) val = g_date_time_new_now_utc ();
83 g_assert_nonnull (val);
84}
85
86static void
87test_g_dir (void)
88{
89 g_autoptr(GDir) val = g_dir_open (path: ".", flags: 0, NULL);
90 g_assert_nonnull (val);
91}
92
93static void
94test_g_error (void)
95{
96 g_autoptr(GError) val = g_error_new_literal (G_FILE_ERROR, code: G_FILE_ERROR_FAILED, message: "oops");
97 g_assert_nonnull (val);
98}
99
100static void
101test_g_hash_table (void)
102{
103 g_autoptr(GHashTable) val = g_hash_table_new (NULL, NULL);
104 g_assert_nonnull (val);
105}
106
107static void
108test_g_hmac (void)
109{
110 g_autoptr(GHmac) val = g_hmac_new (digest_type: G_CHECKSUM_SHA256, key: (guint8*)"hello", key_len: 5);
111 g_assert_nonnull (val);
112}
113
114static void
115test_g_io_channel (void)
116{
117#ifdef G_OS_WIN32
118 const gchar *devnull = "nul";
119#else
120 const gchar *devnull = "/dev/null";
121#endif
122
123 g_autoptr(GIOChannel) val = g_io_channel_new_file (filename: devnull, mode: "r", NULL);
124 g_assert_nonnull (val);
125}
126
127static void
128test_g_key_file (void)
129{
130 g_autoptr(GKeyFile) val = g_key_file_new ();
131 g_assert_nonnull (val);
132}
133
134static void
135test_g_list (void)
136{
137 g_autoptr(GList) val = NULL;
138 g_autoptr(GList) val2 = g_list_prepend (NULL, data: "foo");
139 g_assert_null (val);
140 g_assert_nonnull (val2);
141}
142
143static void
144test_g_array (void)
145{
146 g_autoptr(GArray) val = g_array_new (zero_terminated: 0, clear_: 0, element_size: sizeof (gpointer));
147 g_assert_nonnull (val);
148}
149
150static void
151test_g_ptr_array (void)
152{
153 g_autoptr(GPtrArray) val = g_ptr_array_new ();
154 g_assert_nonnull (val);
155}
156
157static void
158test_g_byte_array (void)
159{
160 g_autoptr(GByteArray) val = g_byte_array_new ();
161 g_assert_nonnull (val);
162}
163
164static void
165test_g_main_context (void)
166{
167 g_autoptr(GMainContext) val = g_main_context_new ();
168 g_assert_nonnull (val);
169}
170
171static void
172test_g_main_context_pusher (void)
173{
174 GMainContext *context, *old_thread_default;
175
176 context = g_main_context_new ();
177 old_thread_default = g_main_context_get_thread_default ();
178 g_assert_false (old_thread_default == context);
179
180 if (TRUE)
181 {
182 g_autoptr(GMainContextPusher) val = g_main_context_pusher_new (main_context: context);
183 g_assert_nonnull (val);
184
185 /* Check it’s now the thread-default main context */
186 g_assert_true (g_main_context_get_thread_default () == context);
187 }
188
189 /* Check it’s now the old thread-default main context */
190 g_assert_false (g_main_context_get_thread_default () == context);
191 g_assert_true (g_main_context_get_thread_default () == old_thread_default);
192
193 g_main_context_unref (context);
194}
195
196static void
197test_g_main_loop (void)
198{
199 g_autoptr(GMainLoop) val = g_main_loop_new (NULL, TRUE);
200 g_assert_nonnull (val);
201}
202
203static void
204test_g_source (void)
205{
206 g_autoptr(GSource) val = g_timeout_source_new_seconds (interval: 2);
207 g_assert_nonnull (val);
208}
209
210static void
211test_g_mapped_file (void)
212{
213 g_autoptr(GMappedFile) val = g_mapped_file_new (filename: g_test_get_filename (file_type: G_TEST_DIST, first_path: "keyfiletest.ini", NULL), FALSE, NULL);
214 g_assert_nonnull (val);
215}
216
217static void
218parser_start (GMarkupParseContext *context,
219 const gchar *element_name,
220 const gchar **attribute_names,
221 const gchar **attribute_values,
222 gpointer user_data,
223 GError **error)
224{
225}
226
227static void
228parser_end (GMarkupParseContext *context,
229 const gchar *element_name,
230 gpointer user_data,
231 GError **error)
232{
233}
234
235static GMarkupParser parser = {
236 .start_element = parser_start,
237 .end_element = parser_end
238};
239
240static void
241test_g_markup_parse_context (void)
242{
243 g_autoptr(GMarkupParseContext) val = g_markup_parse_context_new (parser: &parser, flags: 0, NULL, NULL);
244 g_assert_nonnull (val);
245}
246
247static void
248test_g_node (void)
249{
250 g_autoptr(GNode) val = g_node_new (data: "hello");
251 g_assert_nonnull (val);
252}
253
254static void
255test_g_option_context (void)
256{
257 g_autoptr(GOptionContext) val = g_option_context_new (parameter_string: "hello");
258 g_assert_nonnull (val);
259}
260
261static void
262test_g_option_group (void)
263{
264 g_autoptr(GOptionGroup) val = g_option_group_new (name: "hello", description: "world", help_description: "helpme", NULL, NULL);
265 g_assert_nonnull (val);
266}
267
268static void
269test_g_pattern_spec (void)
270{
271 g_autoptr(GPatternSpec) val = g_pattern_spec_new (pattern: "plaid");
272 g_assert_nonnull (val);
273}
274
275static void
276test_g_queue (void)
277{
278 g_autoptr(GQueue) val = g_queue_new ();
279 g_auto(GQueue) stackval = G_QUEUE_INIT;
280 g_assert_nonnull (val);
281 g_assert_null (stackval.head);
282}
283
284static void
285test_g_rand (void)
286{
287 g_autoptr(GRand) val = g_rand_new ();
288 g_assert_nonnull (val);
289}
290
291static void
292test_g_regex (void)
293{
294 g_autoptr(GRegex) val = g_regex_new (pattern: ".*", compile_options: 0, match_options: 0, NULL);
295 g_assert_nonnull (val);
296}
297
298static void
299test_g_match_info (void)
300{
301 g_autoptr(GRegex) regex = g_regex_new (pattern: ".*", compile_options: 0, match_options: 0, NULL);
302 g_autoptr(GMatchInfo) match = NULL;
303
304 if (!g_regex_match (regex, string: "hello", match_options: 0, match_info: &match))
305 g_assert_not_reached ();
306}
307
308static void
309test_g_scanner (void)
310{
311 GScannerConfig config = { 0, };
312 g_autoptr(GScanner) val = g_scanner_new (config_templ: &config);
313 g_assert_nonnull (val);
314}
315
316static void
317test_g_sequence (void)
318{
319 g_autoptr(GSequence) val = g_sequence_new (NULL);
320 g_assert_nonnull (val);
321}
322
323static void
324test_g_slist (void)
325{
326 g_autoptr(GSList) val = NULL;
327 g_autoptr(GSList) nonempty_val = g_slist_prepend (NULL, data: "hello");
328 g_assert_null (val);
329 g_assert_nonnull (nonempty_val);
330}
331
332static void
333test_g_string (void)
334{
335 g_autoptr(GString) val = g_string_new (init: "");
336 g_assert_nonnull (val);
337}
338
339static void
340test_g_string_chunk (void)
341{
342 g_autoptr(GStringChunk) val = g_string_chunk_new (size: 42);
343 g_assert_nonnull (val);
344}
345
346static gpointer
347mythread (gpointer data)
348{
349 g_usleep (G_USEC_PER_SEC);
350 return NULL;
351}
352
353static void
354test_g_thread (void)
355{
356 g_autoptr(GThread) val = g_thread_new (name: "bob", func: mythread, NULL);
357 g_assert_nonnull (val);
358}
359
360static void
361test_g_mutex (void)
362{
363 g_auto(GMutex) val;
364
365 g_mutex_init (mutex: &val);
366}
367
368/* Thread function to check that a mutex given in @data is locked */
369static gpointer
370mutex_locked_thread (gpointer data)
371{
372 GMutex *mutex = (GMutex *) data;
373 g_assert_false (g_mutex_trylock (mutex));
374 return NULL;
375}
376
377/* Thread function to check that a mutex given in @data is unlocked */
378static gpointer
379mutex_unlocked_thread (gpointer data)
380{
381 GMutex *mutex = (GMutex *) data;
382 g_assert_true (g_mutex_trylock (mutex));
383 g_mutex_unlock (mutex);
384 return NULL;
385}
386
387static void
388test_g_mutex_locker (void)
389{
390 GMutex mutex;
391 GThread *thread;
392
393 g_mutex_init (mutex: &mutex);
394
395 if (TRUE)
396 {
397 g_autoptr(GMutexLocker) val = g_mutex_locker_new (mutex: &mutex);
398
399 g_assert_nonnull (val);
400
401 /* Verify that the mutex is actually locked */
402 thread = g_thread_new (name: "mutex locked", func: mutex_locked_thread, data: &mutex);
403 g_thread_join (thread);
404 }
405
406 /* Verify that the mutex is unlocked again */
407 thread = g_thread_new (name: "mutex unlocked", func: mutex_unlocked_thread, data: &mutex);
408 g_thread_join (thread);
409}
410
411/* Thread function to check that a recursive mutex given in @data is locked */
412static gpointer
413rec_mutex_locked_thread (gpointer data)
414{
415 GRecMutex *rec_mutex = (GRecMutex *) data;
416 g_assert_false (g_rec_mutex_trylock (rec_mutex));
417 return NULL;
418}
419
420/* Thread function to check that a recursive mutex given in @data is unlocked */
421static gpointer
422rec_mutex_unlocked_thread (gpointer data)
423{
424 GRecMutex *rec_mutex = (GRecMutex *) data;
425 g_assert_true (g_rec_mutex_trylock (rec_mutex));
426 return NULL;
427}
428
429static void
430test_g_rec_mutex_locker (void)
431{
432 GRecMutex rec_mutex;
433 GThread *thread;
434
435 g_rec_mutex_init (rec_mutex: &rec_mutex);
436
437 if (TRUE)
438 {
439 g_autoptr(GRecMutexLocker) val = g_rec_mutex_locker_new (rec_mutex: &rec_mutex);
440
441 g_assert_nonnull (val);
442
443 /* Verify that the mutex is actually locked */
444 thread = g_thread_new (name: "rec mutex locked", func: rec_mutex_locked_thread, data: &rec_mutex);
445 g_thread_join (thread);
446 }
447
448 /* Verify that the mutex is unlocked again */
449 thread = g_thread_new (name: "rec mutex unlocked", func: rec_mutex_unlocked_thread, data: &rec_mutex);
450 g_thread_join (thread);
451
452 g_rec_mutex_clear (rec_mutex: &rec_mutex);
453}
454
455/* Thread function to check that an rw lock given in @data cannot be writer locked */
456static gpointer
457rw_lock_cannot_take_writer_lock_thread (gpointer data)
458{
459 GRWLock *lock = (GRWLock *) data;
460 g_assert_false (g_rw_lock_writer_trylock (lock));
461 return NULL;
462}
463
464/* Thread function to check that an rw lock given in @data can be reader locked */
465static gpointer
466rw_lock_can_take_reader_lock_thread (gpointer data)
467{
468 GRWLock *lock = (GRWLock *) data;
469 g_assert_true (g_rw_lock_reader_trylock (lock));
470 g_rw_lock_reader_unlock (rw_lock: lock);
471 return NULL;
472}
473
474static void
475test_g_rw_lock_lockers (void)
476{
477 GRWLock lock;
478 GThread *thread;
479
480 g_rw_lock_init (rw_lock: &lock);
481
482 if (TRUE)
483 {
484 g_autoptr(GRWLockWriterLocker) val = g_rw_lock_writer_locker_new (rw_lock: &lock);
485
486 g_assert_nonnull (val);
487
488 /* Verify that we cannot take another writer lock as a writer lock is currently held */
489 thread = g_thread_new (name: "rw lock cannot take writer lock", func: rw_lock_cannot_take_writer_lock_thread, data: &lock);
490 g_thread_join (thread);
491
492 /* Verify that we cannot take a reader lock as a writer lock is currently held */
493 g_assert_false (g_rw_lock_reader_trylock (&lock));
494 }
495
496 if (TRUE)
497 {
498 g_autoptr(GRWLockReaderLocker) val = g_rw_lock_reader_locker_new (rw_lock: &lock);
499
500 g_assert_nonnull (val);
501
502 /* Verify that we can take another reader lock from another thread */
503 thread = g_thread_new (name: "rw lock can take reader lock", func: rw_lock_can_take_reader_lock_thread, data: &lock);
504 g_thread_join (thread);
505
506 /* ... and also that recursive reader locking from the same thread works */
507 g_assert_true (g_rw_lock_reader_trylock (&lock));
508 g_rw_lock_reader_unlock (rw_lock: &lock);
509
510 /* Verify that we cannot take a writer lock as a reader lock is currently held */
511 thread = g_thread_new (name: "rw lock cannot take writer lock", func: rw_lock_cannot_take_writer_lock_thread, data: &lock);
512 g_thread_join (thread);
513 }
514
515 /* Verify that we can take a writer lock again: this can only work if all of
516 * the locks taken above have been correctly released. */
517 g_assert_true (g_rw_lock_writer_trylock (&lock));
518 g_rw_lock_writer_unlock (rw_lock: &lock);
519
520 g_rw_lock_clear (rw_lock: &lock);
521}
522
523static void
524test_g_cond (void)
525{
526 g_auto(GCond) val;
527 g_cond_init (cond: &val);
528}
529
530static void
531test_g_timer (void)
532{
533 g_autoptr(GTimer) val = g_timer_new ();
534 g_assert_nonnull (val);
535}
536
537static void
538test_g_time_zone (void)
539{
540 g_autoptr(GTimeZone) val = g_time_zone_new_utc ();
541 g_assert_nonnull (val);
542}
543
544static void
545test_g_tree (void)
546{
547 g_autoptr(GTree) val = g_tree_new (key_compare_func: (GCompareFunc)strcmp);
548 g_assert_nonnull (val);
549}
550
551static void
552test_g_variant (void)
553{
554 g_autoptr(GVariant) val = g_variant_new_string (string: "hello");
555 g_assert_nonnull (val);
556}
557
558static void
559test_g_variant_builder (void)
560{
561 g_autoptr(GVariantBuilder) val = g_variant_builder_new (G_VARIANT_TYPE ("as"));
562 g_auto(GVariantBuilder) stackval;
563
564 g_assert_nonnull (val);
565 g_variant_builder_init (builder: &stackval, G_VARIANT_TYPE ("as"));
566}
567
568static void
569test_g_variant_iter (void)
570{
571 g_autoptr(GVariant) var = g_variant_new_fixed_array (G_VARIANT_TYPE_UINT32, elements: "", n_elements: 0, element_size: sizeof(guint32));
572 g_autoptr(GVariantIter) val = g_variant_iter_new (value: var);
573 g_assert_nonnull (val);
574}
575
576static void
577test_g_variant_dict (void)
578{
579 g_autoptr(GVariant) data = g_variant_new_from_data (G_VARIANT_TYPE ("a{sv}"), data: "", size: 0, FALSE, NULL, NULL);
580 g_auto(GVariantDict) stackval;
581 g_autoptr(GVariantDict) val = g_variant_dict_new (from_asv: data);
582
583 g_variant_dict_init (dict: &stackval, from_asv: data);
584 g_assert_nonnull (val);
585}
586
587static void
588test_g_variant_type (void)
589{
590 g_autoptr(GVariantType) val = g_variant_type_new (type_string: "s");
591 g_assert_nonnull (val);
592}
593
594static void
595test_strv (void)
596{
597 g_auto(GStrv) val = g_strsplit(string: "a:b:c", delimiter: ":", max_tokens: -1);
598 g_assert_nonnull (val);
599}
600
601static void
602test_refstring (void)
603{
604 g_autoptr(GRefString) str = g_ref_string_new (str: "hello, world");
605 g_assert_nonnull (str);
606}
607
608static void
609mark_freed (gpointer ptr)
610{
611 gboolean *freed = ptr;
612 *freed = TRUE;
613}
614
615static void
616test_autolist (void)
617{
618 char data[1] = {0};
619 gboolean freed1 = FALSE;
620 gboolean freed2 = FALSE;
621 gboolean freed3 = FALSE;
622 GBytes *b1 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed1);
623 GBytes *b2 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed2);
624 GBytes *b3 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed3);
625
626 {
627 g_autolist(GBytes) l = NULL;
628
629 l = g_list_prepend (list: l, data: b1);
630 l = g_list_prepend (list: l, data: b3);
631
632 /* Squash warnings about dead stores */
633 (void) l;
634 }
635
636 /* Only assert if autoptr works */
637#ifdef __GNUC__
638 g_assert_true (freed1);
639 g_assert_true (freed3);
640#endif
641 g_assert_false (freed2);
642
643 g_bytes_unref (bytes: b2);
644 g_assert_true (freed2);
645}
646
647static void
648test_autoslist (void)
649{
650 char data[1] = {0};
651 gboolean freed1 = FALSE;
652 gboolean freed2 = FALSE;
653 gboolean freed3 = FALSE;
654 GBytes *b1 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed1);
655 GBytes *b2 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed2);
656 GBytes *b3 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed3);
657
658 {
659 g_autoslist(GBytes) l = NULL;
660
661 l = g_slist_prepend (list: l, data: b1);
662 l = g_slist_prepend (list: l, data: b3);
663 }
664
665 /* Only assert if autoptr works */
666#ifdef __GNUC__
667 g_assert_true (freed1);
668 g_assert_true (freed3);
669#endif
670 g_assert_false (freed2);
671
672 g_bytes_unref (bytes: b2);
673 g_assert_true (freed2);
674}
675
676static void
677test_autoqueue (void)
678{
679 char data[1] = {0};
680 gboolean freed1 = FALSE;
681 gboolean freed2 = FALSE;
682 gboolean freed3 = FALSE;
683 GBytes *b1 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed1);
684 GBytes *b2 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed2);
685 GBytes *b3 = g_bytes_new_with_free_func (data, size: sizeof(data), free_func: mark_freed, user_data: &freed3);
686
687 {
688 g_autoqueue(GBytes) q = g_queue_new ();
689
690 g_queue_push_head (queue: q, data: b1);
691 g_queue_push_tail (queue: q, data: b3);
692 }
693
694 /* Only assert if autoptr works */
695#ifdef __GNUC__
696 g_assert_true (freed1);
697 g_assert_true (freed3);
698#endif
699 g_assert_false (freed2);
700
701 g_bytes_unref (bytes: b2);
702 g_assert_true (freed2);
703}
704
705int
706main (int argc, gchar *argv[])
707{
708 g_test_init (argc: &argc, argv: &argv, NULL);
709
710 g_test_add_func (testpath: "/autoptr/autofree", test_func: test_autofree);
711 g_test_add_func (testpath: "/autoptr/g_async_queue", test_func: test_g_async_queue);
712 g_test_add_func (testpath: "/autoptr/g_bookmark_file", test_func: test_g_bookmark_file);
713 g_test_add_func (testpath: "/autoptr/g_bytes", test_func: test_g_bytes);
714 g_test_add_func (testpath: "/autoptr/g_checksum", test_func: test_g_checksum);
715 g_test_add_func (testpath: "/autoptr/g_date", test_func: test_g_date);
716 g_test_add_func (testpath: "/autoptr/g_date_time", test_func: test_g_date_time);
717 g_test_add_func (testpath: "/autoptr/g_dir", test_func: test_g_dir);
718 g_test_add_func (testpath: "/autoptr/g_error", test_func: test_g_error);
719 g_test_add_func (testpath: "/autoptr/g_hash_table", test_func: test_g_hash_table);
720 g_test_add_func (testpath: "/autoptr/g_hmac", test_func: test_g_hmac);
721 g_test_add_func (testpath: "/autoptr/g_io_channel", test_func: test_g_io_channel);
722 g_test_add_func (testpath: "/autoptr/g_key_file", test_func: test_g_key_file);
723 g_test_add_func (testpath: "/autoptr/g_list", test_func: test_g_list);
724 g_test_add_func (testpath: "/autoptr/g_array", test_func: test_g_array);
725 g_test_add_func (testpath: "/autoptr/g_ptr_array", test_func: test_g_ptr_array);
726 g_test_add_func (testpath: "/autoptr/g_byte_array", test_func: test_g_byte_array);
727 g_test_add_func (testpath: "/autoptr/g_main_context", test_func: test_g_main_context);
728 g_test_add_func (testpath: "/autoptr/g_main_context_pusher", test_func: test_g_main_context_pusher);
729 g_test_add_func (testpath: "/autoptr/g_main_loop", test_func: test_g_main_loop);
730 g_test_add_func (testpath: "/autoptr/g_source", test_func: test_g_source);
731 g_test_add_func (testpath: "/autoptr/g_mapped_file", test_func: test_g_mapped_file);
732 g_test_add_func (testpath: "/autoptr/g_markup_parse_context", test_func: test_g_markup_parse_context);
733 g_test_add_func (testpath: "/autoptr/g_node", test_func: test_g_node);
734 g_test_add_func (testpath: "/autoptr/g_option_context", test_func: test_g_option_context);
735 g_test_add_func (testpath: "/autoptr/g_option_group", test_func: test_g_option_group);
736 g_test_add_func (testpath: "/autoptr/g_pattern_spec", test_func: test_g_pattern_spec);
737 g_test_add_func (testpath: "/autoptr/g_queue", test_func: test_g_queue);
738 g_test_add_func (testpath: "/autoptr/g_rand", test_func: test_g_rand);
739 g_test_add_func (testpath: "/autoptr/g_regex", test_func: test_g_regex);
740 g_test_add_func (testpath: "/autoptr/g_match_info", test_func: test_g_match_info);
741 g_test_add_func (testpath: "/autoptr/g_scanner", test_func: test_g_scanner);
742 g_test_add_func (testpath: "/autoptr/g_sequence", test_func: test_g_sequence);
743 g_test_add_func (testpath: "/autoptr/g_slist", test_func: test_g_slist);
744 g_test_add_func (testpath: "/autoptr/g_string", test_func: test_g_string);
745 g_test_add_func (testpath: "/autoptr/g_string_chunk", test_func: test_g_string_chunk);
746 g_test_add_func (testpath: "/autoptr/g_thread", test_func: test_g_thread);
747 g_test_add_func (testpath: "/autoptr/g_mutex", test_func: test_g_mutex);
748 g_test_add_func (testpath: "/autoptr/g_mutex_locker", test_func: test_g_mutex_locker);
749 g_test_add_func (testpath: "/autoptr/g_rec_mutex_locker", test_func: test_g_rec_mutex_locker);
750 g_test_add_func (testpath: "/autoptr/g_rw_lock_lockers", test_func: test_g_rw_lock_lockers);
751 g_test_add_func (testpath: "/autoptr/g_cond", test_func: test_g_cond);
752 g_test_add_func (testpath: "/autoptr/g_timer", test_func: test_g_timer);
753 g_test_add_func (testpath: "/autoptr/g_time_zone", test_func: test_g_time_zone);
754 g_test_add_func (testpath: "/autoptr/g_tree", test_func: test_g_tree);
755 g_test_add_func (testpath: "/autoptr/g_variant", test_func: test_g_variant);
756 g_test_add_func (testpath: "/autoptr/g_variant_builder", test_func: test_g_variant_builder);
757 g_test_add_func (testpath: "/autoptr/g_variant_iter", test_func: test_g_variant_iter);
758 g_test_add_func (testpath: "/autoptr/g_variant_dict", test_func: test_g_variant_dict);
759 g_test_add_func (testpath: "/autoptr/g_variant_type", test_func: test_g_variant_type);
760 g_test_add_func (testpath: "/autoptr/strv", test_func: test_strv);
761 g_test_add_func (testpath: "/autoptr/refstring", test_func: test_refstring);
762 g_test_add_func (testpath: "/autoptr/autolist", test_func: test_autolist);
763 g_test_add_func (testpath: "/autoptr/autoslist", test_func: test_autoslist);
764 g_test_add_func (testpath: "/autoptr/autoqueue", test_func: test_autoqueue);
765
766 return g_test_run ();
767}
768

source code of gtk/subprojects/glib/glib/tests/autoptr.c