check for all three inline keywords individually.
[platform/upstream/glib.git] / testglib.c
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library 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.
8  *
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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 #undef G_LOG_DOMAIN
20
21 #include <stdio.h>
22 #include <string.h>
23 #include "glib.h"
24
25 int array[10000];
26 gboolean failed = FALSE;
27
28 #define TEST(m,cond)    G_STMT_START { failed = !(cond); \
29 if (failed) \
30   { if (!m) \
31       g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
32     else \
33       g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
34   } \
35 else \
36   g_print ("."); fflush (stdout); \
37 } G_STMT_END
38
39 #define C2P(c)          ((gpointer) ((long) (c)))
40 #define P2C(p)          ((gchar) ((long) (p)))
41
42 static gboolean
43 node_build_string (GNode    *node,
44                    gpointer  data)
45 {
46   gchar **p = data;
47   gchar *string;
48   gchar c[2] = "_";
49
50   c[0] = P2C (node->data);
51
52   string = g_strconcat (*p ? *p : "", c, NULL);
53   g_free (*p);
54   *p = string;
55
56   return FALSE;
57 }
58
59 static void
60 g_node_test (void)
61 {
62   GNode *root;
63   GNode *node;
64   GNode *node_B;
65   GNode *node_F;
66   GNode *node_G;
67   GNode *node_J;
68   guint i;
69   gchar *tstring;
70
71   g_print ("checking n-way trees: ");
72   failed = FALSE;
73
74   root = g_node_new (C2P ('A'));
75   TEST (NULL, g_node_depth (root) == 1 && g_node_max_height (root) == 1);
76
77   node_B = g_node_new (C2P ('B'));
78   g_node_append (root, node_B);
79   TEST (NULL, root->children == node_B);
80
81   g_node_append_data (node_B, C2P ('E'));
82   g_node_prepend_data (node_B, C2P ('C'));
83   g_node_insert (node_B, 1, g_node_new (C2P ('D')));
84
85   node_F = g_node_new (C2P ('F'));
86   g_node_append (root, node_F);
87   TEST (NULL, root->children->next == node_F);
88
89   node_G = g_node_new (C2P ('G'));
90   g_node_append (node_F, node_G);
91   node_J = g_node_new (C2P ('J'));
92   g_node_prepend (node_G, node_J);
93   g_node_insert (node_G, 42, g_node_new (C2P ('K')));
94   g_node_insert_data (node_G, 0, C2P ('H'));
95   g_node_insert (node_G, 1, g_node_new (C2P ('I')));
96
97   TEST (NULL, g_node_depth (root) == 1);
98   TEST (NULL, g_node_max_height (root) == 4);
99   TEST (NULL, g_node_depth (node_G->children->next) == 4);
100   TEST (NULL, g_node_n_nodes (root, G_TRAVERSE_LEAFS) == 7);
101   TEST (NULL, g_node_n_nodes (root, G_TRAVERSE_NON_LEAFS) == 4);
102   TEST (NULL, g_node_n_nodes (root, G_TRAVERSE_ALL) == 11);
103   TEST (NULL, g_node_max_height (node_F) == 3);
104   TEST (NULL, g_node_n_children (node_G) == 4);
105   TEST (NULL, g_node_find_child (root, G_TRAVERSE_ALL, C2P ('F')) == node_F);
106   TEST (NULL, g_node_find (root, G_LEVEL_ORDER, G_TRAVERSE_NON_LEAFS, C2P ('I')) == NULL);
107   TEST (NULL, g_node_find (root, G_IN_ORDER, G_TRAVERSE_LEAFS, C2P ('J')) == node_J);
108
109   for (i = 0; i < g_node_n_children (node_B); i++)
110     {
111       node = g_node_nth_child (node_B, i);
112       TEST (NULL, P2C (node->data) == ('C' + i));
113     }
114   
115   for (i = 0; i < g_node_n_children (node_G); i++)
116     TEST (NULL, g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
117
118   /* we have built:                    A
119    *                                 /   \
120    *                               B       F
121    *                             / | \       \
122    *                           C   D   E       G
123    *                                         / /\ \
124    *                                       H  I  J  K
125    *
126    * for in-order traversal, 'G' is considered to be the "left"
127    * child of 'F', which will cause 'F' to be the last node visited.
128    */
129
130   tstring = NULL;
131   g_node_traverse (root, G_PRE_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
132   TEST (tstring, strcmp (tstring, "ABCDEFGHIJK") == 0);
133   g_free (tstring); tstring = NULL;
134   g_node_traverse (root, G_POST_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
135   TEST (tstring, strcmp (tstring, "CDEBHIJKGFA") == 0);
136   g_free (tstring); tstring = NULL;
137   g_node_traverse (root, G_IN_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
138   TEST (tstring, strcmp (tstring, "CBDEAHGIJKF") == 0);
139   g_free (tstring); tstring = NULL;
140   g_node_traverse (root, G_LEVEL_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
141   TEST (tstring, strcmp (tstring, "ABFCDEGHIJK") == 0);
142   g_free (tstring); tstring = NULL;
143   
144   g_node_traverse (root, G_LEVEL_ORDER, G_TRAVERSE_LEAFS, -1, node_build_string, &tstring);
145   TEST (tstring, strcmp (tstring, "CDEHIJK") == 0);
146   g_free (tstring); tstring = NULL;
147   g_node_traverse (root, G_PRE_ORDER, G_TRAVERSE_NON_LEAFS, -1, node_build_string, &tstring);
148   TEST (tstring, strcmp (tstring, "ABFG") == 0);
149   g_free (tstring); tstring = NULL;
150
151   g_node_reverse_children (node_B);
152   g_node_reverse_children (node_G);
153
154   g_node_traverse (root, G_LEVEL_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
155   TEST (tstring, strcmp (tstring, "ABFEDCGKJIH") == 0);
156   g_free (tstring); tstring = NULL;
157   
158   g_node_destroy (root);
159
160   /* allocation tests */
161
162   root = g_node_new (NULL);
163   node = root;
164
165   for (i = 0; i < 2048; i++)
166     {
167       g_node_append (node, g_node_new (NULL));
168       if ((i%5) == 4)
169         node = node->children->next;
170     }
171   TEST (NULL, g_node_max_height (root) > 100);
172   TEST (NULL, g_node_n_nodes (root, G_TRAVERSE_ALL) == 1 + 2048);
173
174   g_node_destroy (root);
175   
176   if (!failed)
177     g_print ("ok\n");
178 }
179
180 void
181 my_hash_callback (gpointer key,
182                   gpointer value,
183                   gpointer user_data)
184 {
185   int *d = value;
186   *d = 1;
187 }
188
189 guint
190 my_hash (gconstpointer key)
191 {
192   return (guint) *((const gint*) key);
193 }
194
195 gint
196 my_hash_compare (gconstpointer a,
197                  gconstpointer b)
198 {
199   return *((const gint*) a) == *((const gint*) b);
200 }
201
202 gint
203 my_list_compare_one (gconstpointer a, gconstpointer b)
204 {
205   gint one = *((const gint*)a);
206   gint two = *((const gint*)b);
207   return one-two;
208 }
209
210 gint
211 my_list_compare_two (gconstpointer a, gconstpointer b)
212 {
213   gint one = *((const gint*)a);
214   gint two = *((const gint*)b);
215   return two-one;
216 }
217
218 /* void
219 my_list_print (gpointer a, gpointer b)
220 {
221   gint three = *((gint*)a);
222   g_print("%d", three);
223 }; */
224
225 gint
226 my_compare (gconstpointer a,
227             gconstpointer b)
228 {
229   const char *cha = a;
230   const char *chb = b;
231
232   return *cha - *chb;
233 }
234
235 gint
236 my_traverse (gpointer key,
237              gpointer value,
238              gpointer data)
239 {
240   char *ch = key;
241   g_print ("%c ", *ch);
242   return FALSE;
243 }
244
245 int
246 main (int   argc,
247       char *argv[])
248 {
249   GList *list, *t;
250   GSList *slist, *st;
251   GHashTable *hash_table;
252   GMemChunk *mem_chunk;
253   GStringChunk *string_chunk;
254   GTimer *timer;
255   gint nums[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
256   gint morenums[10] = { 8, 9, 7, 0, 3, 2, 5, 1, 4, 6};
257   gchar *string;
258
259   gchar *mem[10000], *tmp_string, *tmp_string_2;
260   gint i, j;
261   GArray *garray;
262   GPtrArray *gparray;
263   GByteArray *gbarray;
264   GString *string1, *string2;
265   GTree *tree;
266   char chars[62];
267   GRelation *relation;
268   GTuples *tuples;
269   gint data [1024];
270   struct {
271     gchar *filename;
272     gchar *dirname;
273   } dirname_checks[] = {
274     { "/", "/" },
275     { "////", "/" },
276     { ".////", "." },
277     { ".", "." },
278     { "..", "." },
279     { "../", ".." },
280     { "..////", ".." },
281     { "", "." },
282     { "a/b", "a" },
283     { "a/b/", "a/b" },
284     { "c///", "c" },
285   };
286   guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]);
287
288   g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n",
289            glib_major_version,
290            glib_minor_version,
291            glib_micro_version,
292            glib_interface_age,
293            glib_binary_age);
294
295   string = g_get_current_dir ();
296   g_print ("cwd: %s\n", string);
297   g_free (string);
298
299   /* type sizes */
300   g_print ("checking size of gint8: %d", (int)sizeof (gint8));
301   TEST (NULL, sizeof (gint8) == 1);
302   g_print ("\nchecking size of gint16: %d", (int)sizeof (gint16));
303   TEST (NULL, sizeof (gint16) == 2);
304   g_print ("\nchecking size of gint32: %d", (int)sizeof (gint32));
305   TEST (NULL, sizeof (gint32) == 4);
306 #ifdef  HAVE_GINT64
307   g_print ("\nchecking size of gint64: %d", (int)sizeof (gint64));
308   TEST (NULL, sizeof (gint64) == 8);
309 #endif  /* HAVE_GINT64 */
310   g_print ("\n");
311
312   g_print ("checking g_dirname()...");
313   for (i = 0; i < n_dirname_checks; i++)
314     {
315       gchar *dirname;
316
317       dirname = g_dirname (dirname_checks[i].filename);
318       if (strcmp (dirname, dirname_checks[i].dirname) != 0)
319         {
320           g_print ("\nfailed for \"%s\"==\"%s\" (returned: \"%s\")\n",
321                    dirname_checks[i].filename,
322                    dirname_checks[i].dirname,
323                    dirname);
324           n_dirname_checks = 0;
325         }
326       g_free (dirname);
327     }
328   if (n_dirname_checks)
329     g_print ("ok\n");
330
331   g_print ("checking doubly linked lists...");
332
333   list = NULL;
334   for (i = 0; i < 10; i++)
335     list = g_list_append (list, &nums[i]);
336   list = g_list_reverse (list);
337
338   for (i = 0; i < 10; i++)
339     {
340       t = g_list_nth (list, i);
341       if (*((gint*) t->data) != (9 - i))
342         g_error ("Regular insert failed");
343     }
344
345   for (i = 0; i < 10; i++)
346     if(g_list_position(list, g_list_nth (list, i)) != i)
347       g_error("g_list_position does not seem to be the inverse of g_list_nth\n");
348
349   g_list_free (list);
350   list = NULL;
351
352   for (i = 0; i < 10; i++)
353     list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
354
355   /*
356   g_print("\n");
357   g_list_foreach (list, my_list_print, NULL);
358   */
359
360   for (i = 0; i < 10; i++)
361     {
362       t = g_list_nth (list, i);
363       if (*((gint*) t->data) != i)
364          g_error ("Sorted insert failed");
365     }
366
367   g_list_free (list);
368   list = NULL;
369
370   for (i = 0; i < 10; i++)
371     list = g_list_insert_sorted (list, &morenums[i], my_list_compare_two);
372
373   /*
374   g_print("\n");
375   g_list_foreach (list, my_list_print, NULL);
376   */
377
378   for (i = 0; i < 10; i++)
379     {
380       t = g_list_nth (list, i);
381       if (*((gint*) t->data) != (9 - i))
382          g_error ("Sorted insert failed");
383     }
384
385   g_list_free (list);
386
387   g_print ("ok\n");
388
389
390   g_print ("checking singly linked lists...");
391
392   slist = NULL;
393   for (i = 0; i < 10; i++)
394     slist = g_slist_append (slist, &nums[i]);
395   slist = g_slist_reverse (slist);
396
397   for (i = 0; i < 10; i++)
398     {
399       st = g_slist_nth (slist, i);
400       if (*((gint*) st->data) != (9 - i))
401         g_error ("failed");
402     }
403
404   g_slist_free (slist);
405   slist = NULL;
406
407   for (i = 0; i < 10; i++)
408     slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_one);
409
410   /*
411   g_print("\n");
412   g_slist_foreach (slist, my_list_print, NULL);
413   */
414
415   for (i = 0; i < 10; i++)
416     {
417       st = g_slist_nth (slist, i);
418       if (*((gint*) st->data) != i)
419          g_error ("Sorted insert failed");
420     }
421
422   g_slist_free(slist);
423   slist = NULL;
424
425   for (i = 0; i < 10; i++)
426     slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_two);
427
428   /*
429   g_print("\n");
430   g_slist_foreach (slist, my_list_print, NULL);
431   */
432
433   for (i = 0; i < 10; i++)
434     {
435       st = g_slist_nth (slist, i);
436       if (*((gint*) st->data) != (9 - i))
437          g_error("Sorted insert failed");
438     }
439
440   g_slist_free(slist);
441
442   g_print ("ok\n");
443
444
445   g_print ("checking binary trees...\n");
446
447   tree = g_tree_new (my_compare);
448   i = 0;
449   for (j = 0; j < 10; j++, i++)
450     {
451       chars[i] = '0' + j;
452       g_tree_insert (tree, &chars[i], &chars[i]);
453     }
454   for (j = 0; j < 26; j++, i++)
455     {
456       chars[i] = 'A' + j;
457       g_tree_insert (tree, &chars[i], &chars[i]);
458     }
459   for (j = 0; j < 26; j++, i++)
460     {
461       chars[i] = 'a' + j;
462       g_tree_insert (tree, &chars[i], &chars[i]);
463     }
464
465   g_print ("tree height: %d\n", g_tree_height (tree));
466   g_print ("tree nnodes: %d\n", g_tree_nnodes (tree));
467
468   g_print ("tree: ");
469   g_tree_traverse (tree, my_traverse, G_IN_ORDER, NULL);
470   g_print ("\n");
471
472   for (i = 0; i < 10; i++)
473     g_tree_remove (tree, &chars[i]);
474
475   g_print ("tree height: %d\n", g_tree_height (tree));
476   g_print ("tree nnodes: %d\n", g_tree_nnodes (tree));
477
478   g_print ("tree: ");
479   g_tree_traverse (tree, my_traverse, G_IN_ORDER, NULL);
480   g_print ("\n");
481
482   g_print ("ok\n");
483
484
485   /* check n-way trees */
486   g_node_test ();
487
488   g_print ("checking mem chunks...");
489
490   mem_chunk = g_mem_chunk_new ("test mem chunk", 50, 100, G_ALLOC_AND_FREE);
491
492   for (i = 0; i < 10000; i++)
493     {
494       mem[i] = g_chunk_new (gchar, mem_chunk);
495
496       for (j = 0; j < 50; j++)
497         mem[i][j] = i * j;
498     }
499
500   for (i = 0; i < 10000; i++)
501     {
502       g_mem_chunk_free (mem_chunk, mem[i]);
503     }
504
505   g_print ("ok\n");
506
507
508   g_print ("checking hash tables...");
509
510   hash_table = g_hash_table_new (my_hash, my_hash_compare);
511   for (i = 0; i < 10000; i++)
512     {
513       array[i] = i;
514       g_hash_table_insert (hash_table, &array[i], &array[i]);
515     }
516   g_hash_table_foreach (hash_table, my_hash_callback, NULL);
517
518   for (i = 0; i < 10000; i++)
519     if (array[i] == 0)
520       g_print ("%d\n", i);
521
522   for (i = 0; i < 10000; i++)
523     g_hash_table_remove (hash_table, &array[i]);
524
525   g_hash_table_destroy (hash_table);
526
527   g_print ("ok\n");
528
529
530   g_print ("checking string chunks...");
531
532   string_chunk = g_string_chunk_new (1024);
533
534   for (i = 0; i < 100000; i ++)
535     {
536       tmp_string = g_string_chunk_insert (string_chunk, "hi pete");
537
538       if (strcmp ("hi pete", tmp_string) != 0)
539         g_error ("string chunks are broken.\n");
540     }
541
542   tmp_string_2 = g_string_chunk_insert_const (string_chunk, tmp_string);
543
544   g_assert (tmp_string_2 != tmp_string &&
545             strcmp(tmp_string_2, tmp_string) == 0);
546
547   tmp_string = g_string_chunk_insert_const (string_chunk, tmp_string);
548
549   g_assert (tmp_string_2 == tmp_string);
550
551   g_string_chunk_free (string_chunk);
552
553   g_print ("ok\n");
554
555
556   g_print ("checking arrays...");
557
558   garray = g_array_new (FALSE, FALSE, sizeof (gint));
559   for (i = 0; i < 10000; i++)
560     g_array_append_val (garray, i);
561
562   for (i = 0; i < 10000; i++)
563     if (g_array_index (garray, gint, i) != i)
564       g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), i);
565
566   g_array_free (garray, TRUE);
567
568   garray = g_array_new (FALSE, FALSE, sizeof (gint));
569   for (i = 0; i < 100; i++)
570     g_array_prepend_val (garray, i);
571
572   for (i = 0; i < 100; i++)
573     if (g_array_index (garray, gint, i) != (100 - i - 1))
574       g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 100 - i - 1);
575
576   g_array_free (garray, TRUE);
577
578   g_print ("ok\n");
579
580
581   g_print ("checking strings...");
582
583   string1 = g_string_new ("hi pete!");
584   string2 = g_string_new ("");
585
586   g_assert (strcmp ("hi pete!", string1->str) == 0);
587
588   for (i = 0; i < 10000; i++)
589     g_string_append_c (string1, 'a'+(i%26));
590
591   g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
592                     "this pete guy sure is a wuss, like he's the number ",
593                     1,
594                     " wuss.  everyone agrees.\n",
595                     string1->str,
596                     10, 666, 15, 15, 666.666666666, 666.666666666);
597
598   g_print ("ok\n");
599
600   g_print ("checking timers...\n");
601
602   timer = g_timer_new ();
603   g_print ("  spinning for 3 seconds...\n");
604
605   g_timer_start (timer);
606   while (g_timer_elapsed (timer, NULL) < 3)
607     ;
608
609   g_timer_stop (timer);
610   g_timer_destroy (timer);
611
612   g_print ("ok\n");
613
614   g_print ("checking g_strcasecmp...\n");
615
616   /* g_debug (argv[0]); */
617
618   /* Relation tests */
619
620   g_print ("checking relations...");
621
622   relation = g_relation_new (2);
623
624   g_relation_index (relation, 0, g_int_hash, g_int_equal);
625   g_relation_index (relation, 1, g_int_hash, g_int_equal);
626
627   for (i = 0; i < 1024; i += 1)
628     data[i] = i;
629
630   for (i = 1; i < 1023; i += 1)
631     {
632       g_relation_insert (relation, data + i, data + i + 1);
633       g_relation_insert (relation, data + i, data + i - 1);
634     }
635
636   for (i = 2; i < 1022; i += 1)
637     {
638       g_assert (! g_relation_exists (relation, data + i, data + i));
639       g_assert (! g_relation_exists (relation, data + i, data + i + 2));
640       g_assert (! g_relation_exists (relation, data + i, data + i - 2));
641     }
642
643   for (i = 1; i < 1023; i += 1)
644     {
645       g_assert (g_relation_exists (relation, data + i, data + i + 1));
646       g_assert (g_relation_exists (relation, data + i, data + i - 1));
647     }
648
649   for (i = 2; i < 1022; i += 1)
650     {
651       g_assert (g_relation_count (relation, data + i, 0) == 2);
652       g_assert (g_relation_count (relation, data + i, 1) == 2);
653     }
654
655   g_assert (g_relation_count (relation, data, 0) == 0);
656
657   g_assert (g_relation_count (relation, data + 42, 0) == 2);
658   g_assert (g_relation_count (relation, data + 43, 1) == 2);
659   g_assert (g_relation_count (relation, data + 41, 1) == 2);
660   g_relation_delete (relation, data + 42, 0);
661   g_assert (g_relation_count (relation, data + 42, 0) == 0);
662   g_assert (g_relation_count (relation, data + 43, 1) == 1);
663   g_assert (g_relation_count (relation, data + 41, 1) == 1);
664
665   tuples = g_relation_select (relation, data + 200, 0);
666
667   g_assert (tuples->len == 2);
668
669 #if 0
670   for (i = 0; i < tuples->len; i += 1)
671     {
672       printf ("%d %d\n",
673               *(gint*) g_tuples_index (tuples, i, 0),
674               *(gint*) g_tuples_index (tuples, i, 1));
675     }
676 #endif
677
678   g_assert (g_relation_exists (relation, data + 300, data + 301));
679   g_relation_delete (relation, data + 300, 0);
680   g_assert (!g_relation_exists (relation, data + 300, data + 301));
681
682   g_tuples_destroy (tuples);
683
684   g_relation_destroy (relation);
685
686   relation = NULL;
687
688   g_print ("ok\n");
689
690   g_print ("checking pointer arrays...");
691
692   gparray = g_ptr_array_new ();
693   for (i = 0; i < 10000; i++)
694     g_ptr_array_add (gparray, GINT_TO_POINTER (i));
695
696   for (i = 0; i < 10000; i++)
697     if (g_ptr_array_index (gparray, i) != GINT_TO_POINTER (i))
698       g_print ("array fails: %p ( %p )\n", g_ptr_array_index (gparray, i), GINT_TO_POINTER (i));
699
700   g_ptr_array_free (gparray, TRUE);
701
702   g_print ("ok\n");
703
704
705   g_print ("checking byte arrays...");
706
707   gbarray = g_byte_array_new ();
708   for (i = 0; i < 10000; i++)
709     g_byte_array_append (gbarray, (guint8*) "abcd", 4);
710
711   for (i = 0; i < 10000; i++)
712     {
713       g_assert (gbarray->data[4*i] == 'a');
714       g_assert (gbarray->data[4*i+1] == 'b');
715       g_assert (gbarray->data[4*i+2] == 'c');
716       g_assert (gbarray->data[4*i+3] == 'd');
717     }
718
719   g_byte_array_free (gbarray, TRUE);
720   g_print ("ok\n");
721
722   g_printerr ("g_log tests:");
723   g_warning ("harmless warning");
724   g_message ("the next warning is a test:");
725   string = NULL;
726   g_print (string);
727
728   return 0;
729 }