Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 #undef G_DISABLE_ASSERT
31 #include "mrt2_glib2_test.h"
34 void func(GQuark key_id,gpointer data,gpointer user_data)
36 gint *udata = (int *)user_data;
44 gchar *str1 = "test1",*str2 = "test2",*str3,*str4;
48 g_datalist_init(&datalist);
50 //check for g_datalist_init.
51 g_assert(datalist == NULL);
53 q1 = g_quark_from_string(str1);
54 q2 = g_quark_from_string(str2);
56 g_datalist_id_set_data_full(&datalist,q1,str1,NULL);
57 g_datalist_id_set_data_full(&datalist,q2,str2,NULL);
59 str3 = g_datalist_id_get_data(&datalist,q1);
60 str4 = g_datalist_id_get_data(&datalist,q2);
62 //checks g_datalist_id_set_data_full and g_datalist_id_get_data
63 g_assert(!strcmp(str1,str3) && !strcmp(str2,str4));
65 str3 = g_datalist_id_get_data(&datalist,5);
67 g_assert(str3 == NULL);
69 g_datalist_foreach(&datalist,func,&user_data);
71 // checks g_datalist_foreach. user_data should become 2 as the function will be called twice for
73 g_assert(user_data == 2);
75 g_datalist_set_flags(&datalist,0x0);
77 flags = g_datalist_get_flags(&datalist);
79 //checks g_datalist_set_flags and g_datalist_set_flags
90 g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
91 g_set_print_handler(mrtPrintHandler);
97 testResultXml("datalist_test");