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.
25 #undef G_DISABLE_ASSERT
33 #include "mrt2_glib2_test.h"
38 char a[50],b[50],c[50];
41 void function(GQuark key_id,gpointer data,gpointer user_data)
43 int *i = (int *)user_data;
49 struct data *d = g_malloc(sizeof(struct data));
50 gchar *str1,*str2,*str3,*str4,*str5,*str6;
59 q1 = g_quark_from_string(d->a);
60 q2 = g_quark_from_string(d->b);
61 q3 = g_quark_from_string(d->c);
63 g_dataset_id_set_data_full(d,q1,d->a,NULL);
64 g_dataset_id_set_data_full(d,q2,d->b,NULL);
65 g_dataset_id_set_data_full(d,q3,d->c,NULL);
67 str1 = g_dataset_id_get_data(d,q1);
68 str2 = g_dataset_id_get_data(d,q2);
69 str3 = g_dataset_id_get_data(d,q3);
71 // These assertions will check whether g_dataset_id_set_data_full &
72 // g_dataset_id_get_data is sucessful or not
73 g_assert(!strcmp(str1,d->a));
74 g_assert(!strcmp(str2,d->b));
75 g_assert(!strcmp(str3,d->c));
77 str4 = g_dataset_id_remove_no_notify(d,q1);
78 str5 = g_dataset_id_get_data(d,q1);
80 //This assertion will check if g_dataset_id_remove_no_notify is sucessful or not
81 g_assert(!strcmp(str4,d->a));
82 g_assert(str5 == NULL);
84 g_dataset_foreach(d,function,&user_data);
87 //This assertion will check if g_dataset_foreach is sucessful or not
88 g_assert(user_data == 2);
92 str6 = g_dataset_id_get_data(d,q2);
94 //This assertion will check if g_dataset_destroy is successful or not
95 g_assert(str5 == NULL);
104 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);
110 testResultXml("dataset_test");
111 #endif /* EMULATOR */