}
if (g_test_verbose ())
- g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
+ g_printerr ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (instance, pspec->name, &value);
check_property ("Property", pspec, &value);
/* Test if we get URI string */
uri = g_file_get_uri (file1);
g_assert_cmpstr (uri, !=, NULL);
- g_print ("%s\n",uri);
+ g_printerr ("%s\n",uri);
/* Test if we get correct value of the local path */
path = g_file_get_path (file1);
g_assert (file2 != NULL);
has_prefix = g_file_has_prefix (file2, file1);
- g_print ("%s %s\n", dir1, dir2);
+ g_printerr ("%s %s\n", dir1, dir2);
g_assert (has_prefix == should_have_prefix);
relative_path = g_file_get_relative_path (file1, file2);
now_tm = localtime (&now_time);
strftime (time_buf, sizeof time_buf, "%H:%M:%S", now_tm);
- g_print ("%s.%06d: %s\n",
+ g_printerr ("%s.%06d: %s\n",
time_buf, (gint) now.tv_usec / 1000,
str);
g_free (str);
#if 0
if (g_strv_length ((gchar**)interfaces) != i - 1)
{
- g_print ("expected ");
+ g_printerr ("expected ");
for (i = 0; interfaces[i]; i++)
- g_print ("%s ", interfaces[i]);
- g_print ("\ngot ");
+ g_printerr ("%s ", interfaces[i]);
+ g_printerr ("\ngot ");
for (i = 0; node_info->interfaces[i]; i++)
- g_print ("%s ", node_info->interfaces[i]->name);
- g_print ("\n");
+ g_printerr ("%s ", node_info->interfaces[i]->name);
+ g_printerr ("\n");
}
#endif
g_assert_cmpint (g_strv_length ((gchar**)interfaces), ==, i - 1);
GError *error;
guint reg_id;
- //g_print ("Client connected.\n"
+ //g_printerr ("Client connected.\n"
// "Negotiated capabilities: unix-fd-passing=%d\n",
// g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
ExampleAnimal *animal = user_data;
GError *error = NULL;
- /* g_print ("Client connected.\n" */
+ /* g_printerr ("Client connected.\n" */
/* "Negotiated capabilities: unix-fd-passing=%d\n", */
/* g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING); */
GVariant *ret;
if (g_test_verbose ())
- g_print (".");
+ g_printerr (".");
proxy = g_dbus_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
* for all the oustanding method calls to complete...
*/
if (g_test_verbose ())
- g_print ("\n");
+ g_printerr ("\n");
}
int
{
default:
case 0:
- g_print ("failing and om_data->state=%d on signal %s, params=%s\n",
+ g_printerr ("failing and om_data->state=%d on signal %s, params=%s\n",
om_data->state,
signal_name,
g_variant_print (parameters, TRUE));
data);
g_main_loop_run (data->thread_loop);
if (g_test_verbose ())
- g_print ("A");
+ g_printerr ("A");
//g_debug ("done invoking async (%p)", g_thread_self ());
}
else
NULL,
&error);
if (g_test_verbose ())
- g_print ("S");
+ g_printerr ("S");
//g_debug ("done invoking sync (%p)", g_thread_self ());
g_assert_no_error (error);
g_assert (result != NULL);
g_assert_cmpint (elapsed_msec, <, 8000);
if (g_test_verbose ())
- g_print (" ");
+ g_printerr (" ");
}
}
g_object_unref (connection);
if (g_test_verbose ())
- g_print ("\n");
+ g_printerr ("\n");
}
#define SLEEP_MIN_USEC 1
g_error ("connection had too many refs");
if (g_test_verbose () && (i % (n/50)) == 0)
- g_print ("%u%%\n", ((i * 100) / n));
+ g_printerr ("%u%%\n", ((i * 100) / n));
/* Delay for a random time on each side of the race, to perturb the
* timing. Ideally, we want each side to win half the races; these
}
if (g_test_verbose ())
- g_print ("Unref won %u races; Get won %u races\n", unref_wins, get_wins);
+ g_printerr ("Unref won %u races; Get won %u races\n", unref_wins, get_wins);
}
/* ---------------------------------------------------------------------------------------------------- */
static gboolean posix_compat;
#ifdef G_HAVE_ISO_VARARGS
-#define log(...) if (verbose) g_print (__VA_ARGS__)
+#define log(...) if (verbose) g_printerr (__VA_ARGS__)
#elif defined(G_HAVE_GNUC_VARARGS)
-#define log(msg...) if (verbose) g_print (msg)
+#define log(msg...) if (verbose) g_printerr (msg)
#else /* no varargs macros */
static void log (const g_char *format, ...)
{
va_list args;
va_start (args, format);
- if (verbose) g_print (format, args);
+ if (verbose) g_printerr (format, args);
va_end (args);
}
#endif
g_option_context_add_main_entries (context, cmd_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
- g_print ("option parsing failed: %s\n", error->message);
+ g_printerr ("option parsing failed: %s\n", error->message);
return g_test_run ();
}
if (! target_path)
{
- g_print ("error: target path was not specified\n");
- g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
+ g_printerr ("error: target path was not specified\n");
+ g_printerr ("%s", g_option_context_get_help (context, TRUE, NULL));
return g_test_run ();
}
: g_bit_trylock (&locks[nr], bits[nr])))
{
if (g_test_verbose ())
- g_print ("thread %p going to block on lock %d\n", self, nr);
+ g_printerr ("thread %p going to block on lock %d\n", self, nr);
if (use_pointers)
g_pointer_bit_lock (&ptrs[nr], bits[nr]);
data2 = g_base64_decode (datap, &len);
g_assert_cmpint (len, ==, p->length);
- /* g_print ("length: got %d, expected %d\n",len, length); */
+ /* g_printerr ("length: got %d, expected %d\n",len, length); */
memcmp_decode = memcmp (p->data, data2, p->length);
g_assert_cmpint (memcmp_decode, ==, 0);
g_free (data2);
data = g_strdup (datap);
data2 = g_base64_decode_inplace (data, &len);
g_assert_cmpint (len, ==, p->length);
- /* g_print ("length: got %d, expected %d\n",len, length); */
+ /* g_printerr ("length: got %d, expected %d\n",len, length); */
memcmp_decode = memcmp (p->data, data2, p->length);
g_assert_cmpint (memcmp_decode, ==, 0);
g_free (data2);
res = g_bookmark_file_load_from_file (bookmark, filename, &error);
if (error && g_test_verbose ())
- g_print ("Load error: %s\n", error->message);
+ g_printerr ("Load error: %s\n", error->message);
g_clear_error (&error);
return res;
gchar *mime;
if (g_test_verbose ())
- g_print ("\t=> check global title/description...");
+ g_printerr ("\t=> check global title/description...");
g_bookmark_file_set_title (bookmark, NULL, "a file");
g_bookmark_file_set_description (bookmark, NULL, "a bookmark file");
g_assert_cmpstr (text, ==, "a bookmark file");
g_free (text);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose ())
- g_print ("\t=> check bookmark title/description...");
+ g_printerr ("\t=> check bookmark title/description...");
g_bookmark_file_set_title (bookmark, TEST_URI_0, "a title");
g_bookmark_file_set_description (bookmark, TEST_URI_0, "a description");
g_bookmark_file_set_is_private (bookmark, TEST_URI_0, TRUE);
g_free (icon);
g_free (mime);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose ())
- g_print ("\t=> check non existing bookmark...");
+ g_printerr ("\t=> check non existing bookmark...");
g_bookmark_file_get_description (bookmark, TEST_URI_1, &error);
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose ())
- g_print ("\t=> check application...");
+ g_printerr ("\t=> check application...");
g_bookmark_file_set_mime_type (bookmark, TEST_URI_0, TEST_MIME);
g_assert (!g_bookmark_file_has_application (bookmark, TEST_URI_0, TEST_APP_NAME, NULL));
g_bookmark_file_add_application (bookmark, TEST_URI_0,
g_clear_error (&error);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose ())
- g_print ("\t=> check groups...");
+ g_printerr ("\t=> check groups...");
g_assert (!g_bookmark_file_has_group (bookmark, TEST_URI_1, "Test", NULL));
g_bookmark_file_add_group (bookmark, TEST_URI_1, "Test");
g_assert (g_bookmark_file_has_group (bookmark, TEST_URI_1, "Test", NULL));
g_assert_no_error (error);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose ())
- g_print ("\t=> check remove...");
+ g_printerr ("\t=> check remove...");
g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == TRUE);
g_assert_no_error (error);
g_assert (g_bookmark_file_remove_item (bookmark, TEST_URI_1, &error) == FALSE);
g_assert_error (error, G_BOOKMARK_FILE_ERROR, G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND);
g_clear_error (&error);
if (g_test_verbose ())
- g_print ("ok\n");
+ g_printerr ("ok\n");
return TRUE;
}
g_cond_wait (&cond, &mutex);
next = value;
if (g_test_verbose ())
- g_print ("Thread %p producing next value: %d\n", g_thread_self (), value);
+ g_printerr ("Thread %p producing next value: %d\n", g_thread_self (), value);
if (value % 10 == 0)
g_cond_broadcast (&cond);
else
while (next == 0)
{
if (g_test_verbose ())
- g_print ("Thread %p waiting for cond\n", g_thread_self ());
+ g_printerr ("Thread %p waiting for cond\n", g_thread_self ());
g_cond_wait (&cond, &mutex);
}
value = next;
next = 0;
g_cond_broadcast (&cond);
if (g_test_verbose ())
- g_print ("Thread %p consuming value %d\n", g_thread_self (), value);
+ g_printerr ("Thread %p consuming value %d\n", g_thread_self (), value);
g_mutex_unlock (&mutex);
return value;
push_value (-1);
if (g_test_verbose ())
- g_print ("Thread %p produced %d altogether\n", g_thread_self (), total);
+ g_printerr ("Thread %p produced %d altogether\n", g_thread_self (), total);
return GINT_TO_POINTER (total);
}
}
if (g_test_verbose ())
- g_print ("Thread %p accumulated %d\n", g_thread_self (), accum);
+ g_printerr ("Thread %p accumulated %d\n", g_thread_self (), accum);
return GINT_TO_POINTER (accum);
}
g_atomic_int_inc (&check);
if (g_test_verbose ())
- g_print ("thread %d starting, check %d\n", value, g_atomic_int_get (&check));
+ g_printerr ("thread %d starting, check %d\n", value, g_atomic_int_get (&check));
g_usleep (10000 * value);
g_atomic_int_inc (&check);
if (g_test_verbose ())
- g_print ("thread %d reaching barrier, check %d\n", value, g_atomic_int_get (&check));
+ g_printerr ("thread %d reaching barrier, check %d\n", value, g_atomic_int_get (&check));
ret = barrier_wait (&b);
g_assert_cmpint (g_atomic_int_get (&check), ==, 10);
if (g_test_verbose ())
- g_print ("thread %d leaving barrier (%d), check %d\n", value, ret, g_atomic_int_get (&check));
+ g_printerr ("thread %d leaving barrier (%d), check %d\n", value, ret, g_atomic_int_get (&check));
return NULL;
}
{
gchar *cwd;
if (g_test_verbose())
- g_print ("checking g_mkdir_with_parents() in subdir ./hum/");
+ g_printerr ("checking g_mkdir_with_parents() in subdir ./hum/");
test_mkdir_with_parents_1 ("hum");
g_remove ("hum");
if (g_test_verbose())
- g_print ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
+ g_printerr ("checking g_mkdir_with_parents() in subdir ./hii///haa/hee/");
test_mkdir_with_parents_1 ("hii///haa/hee");
g_remove ("hii/haa/hee");
g_remove ("hii/haa");
g_remove ("hii");
cwd = g_get_current_dir ();
if (g_test_verbose())
- g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
+ g_printerr ("checking g_mkdir_with_parents() in cwd: %s", cwd);
test_mkdir_with_parents_1 (cwd);
g_free (cwd);
dt = g_date_time_new_from_timeval_local (&tv);
if (g_test_verbose ())
- g_print ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
+ g_printerr ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_date_time_get_year (dt),
g_date_time_get_month (dt),
g_date_time_get_day_of_month (dt),
dt = g_date_time_new_from_timeval_utc (&tv);
if (g_test_verbose ())
- g_print ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
+ g_printerr ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_date_time_get_year (dt),
g_date_time_get_month (dt),
g_date_time_get_day_of_month (dt),
dt = g_date_time_new (timezone, year, month, day, 0, 0, 0);
#if 0
- g_print ("%04d-%02d-%02d = %04d-W%02d-%d = %04d-%03d\n",
+ g_printerr ("%04d-%02d-%02d = %04d-W%02d-%d = %04d-%03d\n",
year, month, day,
week_year, week_num, weekday,
year, day_of_year);
if (!g_mutex_trylock (&locks[nr]))
{
if (g_test_verbose ())
- g_print ("thread %p going to block on lock %d\n", self, nr);
+ g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_mutex_lock (&locks[nr]);
}
g_assert_cmpint (GPOINTER_TO_INT (value), ==, v);
if (g_test_verbose ())
- g_print ("thread %d set sp5\n", v);
+ g_printerr ("thread %d set sp5\n", v);
g_mutex_lock (&m5);
g_atomic_int_inc (&count5);
g_cond_signal (&c5a);
g_mutex_unlock (&m5);
if (g_test_verbose ())
- g_print ("thread %d get sp5\n", v);
+ g_printerr ("thread %d get sp5\n", v);
value = g_static_private_get (&sp5);
g_assert (value == NULL);
g_cond_wait (&c5a, &m5);
if (g_test_verbose ())
- g_print ("sp5 gets nuked\n");
+ g_printerr ("sp5 gets nuked\n");
g_static_private_free (&sp5);
if (qinf->head != q->head ||
qinf->tail != q->tail ||
qinf->length != q->length)
- g_print ("op: %d\n", op);
+ g_printerr ("op: %d\n", op);
g_assert (qinf->head == q->head);
g_assert (qinf->tail == q->tail);
if (!g_rec_mutex_trylock (&locks[nr]))
{
if (g_test_verbose ())
- g_print ("thread %p going to block on lock %d\n", self, nr);
+ g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_rec_mutex_lock (&locks[nr]);
}
g_assert (owners[nr] == self); /* hopefully this is still us... */
if (g_test_verbose ())
- g_print ("thread %p recursively taking lock %d\n", self, nr);
+ g_printerr ("thread %p recursively taking lock %d\n", self, nr);
g_rec_mutex_lock (&locks[nr]); /* we're recursive, after all */
if (!g_rw_lock_writer_trylock (&locks[nr]))
{
if (g_test_verbose ())
- g_print ("thread %p going to block on lock %d\n", self, nr);
+ g_printerr ("thread %p going to block on lock %d\n", self, nr);
g_rw_lock_writer_lock (&locks[nr]);
}
#if 0
if (g_sequence_get_length (info->sequence) != info->n_items)
- g_print ("%d %d\n",
+ g_printerr ("%d %d\n",
g_sequence_get_length (info->sequence), info->n_items);
#endif
g_assert (info->n_items == g_queue_get_length (info->queue));
while (iter != g_sequence_get_end_iter (seq->sequence))
{
Item *item = get_item (iter);
- g_print ("%p %p %d\n", list->data, iter, item->number);
+ g_printerr ("%p %p %d\n", list->data, iter, item->number);
iter = g_sequence_iter_next (iter);
list = list->next;
int k;
#if 0
- g_print (" seed: %u\n", seed);
+ g_printerr (" seed: %u\n", seed);
#endif
g_random_set_seed (seed);
int op = g_random_int_range (0, N_OPS);
#if 0
- g_print ("%d on %p\n", op, seq);
+ g_printerr ("%d on %p\n", op, seq);
#endif
switch (op)
gboolean res;
err = NULL;
-g_print ("test cmdline: %s\n", test->cmdline);
+ g_printerr ("test cmdline: %s\n", test->cmdline);
res = g_shell_parse_argv (test->cmdline, &argc, &argv, &err);
if (test->error_code == -1)
{
test_version (void)
{
if (g_test_verbose ())
- g_print ("(header %d.%d.%d library %d.%d.%d) ",
+ g_printerr ("(header %d.%d.%d library %d.%d.%d) ",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
glib_major_version, glib_minor_version, glib_micro_version);
fahrenheit = (9 * celsius / 5) + 32.0;
if (g_test_verbose ())
- g_print ("Converting %.2fC to %.2fF\n", celsius, fahrenheit);
+ g_printerr ("Converting %.2fC to %.2fF\n", celsius, fahrenheit);
g_value_set_double (to_value, fahrenheit);
celsius = 5 * (fahrenheit - 32.0) / 9;
if (g_test_verbose ())
- g_print ("Converting %.2fF to %.2fC\n", fahrenheit, celsius);
+ g_printerr ("Converting %.2fF to %.2fC\n", fahrenheit, celsius);
g_value_set_double (to_value, celsius);
/* first, syncronize with other threads,
*/
if (g_test_verbose())
- g_print ("WAITING!\n");
+ g_printerr ("WAITING!\n");
g_mutex_lock (&sync_mutex);
g_mutex_unlock (&sync_mutex);
if (g_test_verbose ())
- g_print ("STARTING\n");
+ g_printerr ("STARTING\n");
/* ref/unref the klass 10000000 times */
for (i = N_REFS; i; i--) {
if (g_test_verbose ())
if (i % 10)
- g_print ("%d\n", i);
+ g_printerr ("%d\n", i);
g_type_class_unref (g_type_class_ref ((GType) data));
}
if (g_test_verbose())
- g_print ("DONE !\n");
+ g_printerr ("DONE !\n");
return NULL;
}
TestObjectPrivate *priv = test_object_get_instance_private (self);
if (g_test_verbose ())
- g_print ("Offset of %sPrivate for type '%s': %d\n",
+ g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestObject_private_offset);
TestDerivedPrivate *priv = test_derived_get_instance_private (self);
if (g_test_verbose ())
- g_print ("Offset of %sPrivate for type '%s': %d\n",
+ g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestDerived_private_offset);
TestMixedPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, test_mixed_get_type (), TestMixedPrivate);
if (g_test_verbose ())
- g_print ("Offset of %sPrivate for type '%s': %d\n",
+ g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestMixed_private_offset);
TestMixedDerivedPrivate *priv = test_mixed_derived_get_instance_private (self);
if (g_test_verbose ())
- g_print ("Offset of %sPrivate for type '%s': %d\n",
+ g_printerr ("Offset of %sPrivate for type '%s': %d\n",
G_OBJECT_TYPE_NAME (self),
G_OBJECT_TYPE_NAME (self),
TestMixedDerived_private_offset);
while (g_atomic_int_get (&mtsafe_call_counter) < (3 + 3 + 3 * 3) * NUM_COUNTER_INCREMENTS)
{
if (g_test_verbose())
- g_print ("Initializers counted: %u\n", g_atomic_int_get (&mtsafe_call_counter));
+ g_printerr ("Initializers counted: %u\n", g_atomic_int_get (&mtsafe_call_counter));
g_usleep (50 * 1000); /* wait for threads to complete */
}
if (g_test_verbose())
- g_print ("Total initializers: %u\n", g_atomic_int_get (&mtsafe_call_counter));
+ g_printerr ("Total initializers: %u\n", g_atomic_int_get (&mtsafe_call_counter));
/* ensure non-corrupted counter updates */
g_assert_cmpint (g_atomic_int_get (&mtsafe_call_counter), ==, unsafe_call_counter);
GError *error = NULL;
if (g_test_verbose () && (i % (n/20)) == 0)
- g_print ("%u%%\n", ((i * 100) / n));
+ g_printerr ("%u%%\n", ((i * 100) / n));
/* Have an object and a weak ref to it */
data.strong = g_object_new (my_tester0_get_type (), NULL);
}
if (g_test_verbose ())
- g_print ("Race won by get %u times, unref %u times\n",
+ g_printerr ("Race won by get %u times, unref %u times\n",
get_wins, unref_wins);
}
#define DEBUG_MSG(args)
/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n"); */
#define PRINT_MSG(args)
-/* #define PRINT_MSG(args) g_print args ; g_print ("\n"); */
+/* #define PRINT_MSG(args) g_printerr args ; g_printerr ("\n"); */
#define MAX_THREADS 50
#define MAX_SORTS 5 /* only applies if
my_list_print (gpointer a, gpointer b)
{
gint three = *((gint*)a);
- g_print("%d", three);
+ g_printerr ("%d", three);
}; */
static void
list = g_list_insert_sorted (list, &more_nums[i], my_list_compare_one);
/*
- g_print("\n");
+ g_printerr ("\n");
g_list_foreach (list, my_list_print, NULL);
*/
list = g_list_insert_sorted (list, &more_nums[i], my_list_compare_two);
/*
- g_print("\n");
+ g_printerr ("\n");
g_list_foreach (list, my_list_print, NULL);
*/
list = g_list_sort (list, my_list_compare_two);
/*
- g_print("\n");
+ g_printerr ("\n");
g_list_foreach (list, my_list_print, NULL);
*/
slist = g_slist_insert_sorted (slist, &more_nums[i], my_list_compare_one);
/*
- g_print("\n");
+ g_printerr ("\n");
g_slist_foreach (slist, my_list_print, NULL);
*/
slist = g_slist_insert_sorted (slist, &more_nums[i], my_list_compare_two);
/*
- g_print("\n");
+ g_printerr ("\n");
g_slist_foreach (slist, my_list_print, NULL);
*/
slist = g_slist_sort (slist, my_list_compare_two);
/*
- g_print("\n");
+ g_printerr ("\n");
g_slist_foreach (slist, my_list_print, NULL);
*/
gpointer data)
{
char *ch = key;
- g_print ("%c ", *ch);
+ g_printerr ("%c ", *ch);
return FALSE;
}
if (g_test_verbose())
{
- g_print ("tree: ");
+ g_printerr ("tree: ");
g_tree_foreach (tree, my_traverse, NULL);
- g_print ("\n");
+ g_printerr ("\n");
}
for (i = 0; i < 10; i++)
if (g_test_verbose())
{
- g_print ("tree: ");
+ g_printerr ("tree: ");
g_tree_foreach (tree, my_traverse, NULL);
- g_print ("\n");
+ g_printerr ("\n");
}
g_tree_unref (tree);
if (g_test_slow())
{
if (g_test_verbose())
- g_print ("checking timers...\n");
+ g_printerr ("checking timers...\n");
timer = g_timer_new ();
if (g_test_verbose())
- g_print (" spinning for 3 seconds...\n");
+ g_printerr (" spinning for 3 seconds...\n");
g_timer_start (timer);
while (g_timer_elapsed (timer, NULL) < 3)
;
g_timer_stop (timer);
g_timer_destroy (timer);
if (g_test_verbose())
- g_print ("ok\n");
+ g_printerr ("ok\n");
}
if (g_test_slow())
{
gulong elapsed_usecs;
if (g_test_verbose())
- g_print ("checking g_timer_continue...\n");
+ g_printerr ("checking g_timer_continue...\n");
timer2 = g_timer_new ();
if (g_test_verbose())
- g_print ("\trun for 1 second...\n");
+ g_printerr ("\trun for 1 second...\n");
timer = g_timer_new();
g_usleep (G_USEC_PER_SEC); /* run timer for 1 second */
g_timer_stop (timer);
if (g_test_verbose())
- g_print ("\tstop for 1 second...\n");
+ g_printerr ("\tstop for 1 second...\n");
g_usleep (G_USEC_PER_SEC); /* wait for 1 second */
if (g_test_verbose())
- g_print ("\trun for 2 seconds...\n");
+ g_printerr ("\trun for 2 seconds...\n");
g_timer_continue (timer);
g_usleep (2 * G_USEC_PER_SEC); /* run timer for 2 seconds */
g_timer_stop(timer);
if (g_test_verbose())
- g_print ("\tstop for 1.5 seconds...\n");
+ g_printerr ("\tstop for 1.5 seconds...\n");
g_usleep ((3 * G_USEC_PER_SEC) / 2); /* wait for 1.5 seconds */
if (g_test_verbose())
- g_print ("\trun for 0.2 seconds...\n");
+ g_printerr ("\trun for 0.2 seconds...\n");
g_timer_continue (timer);
g_usleep (G_USEC_PER_SEC / 5); /* run timer for 0.2 seconds */
g_timer_stop (timer);
if (g_test_verbose())
- g_print ("\tstop for 4 seconds...\n");
+ g_printerr ("\tstop for 4 seconds...\n");
g_usleep (4 * G_USEC_PER_SEC); /* wait for 4 seconds */
if (g_test_verbose())
- g_print ("\trun for 5.8 seconds...\n");
+ g_printerr ("\trun for 5.8 seconds...\n");
g_timer_continue (timer);
g_usleep ((29 * G_USEC_PER_SEC) / 5); /* run timer for 5.8 seconds */
g_timer_stop(timer);
elapsed = g_timer_elapsed (timer, &elapsed_usecs);
if (g_test_verbose())
- g_print ("\t=> timer = %.6f = %d.%06ld (should be: 9.000000) (%.6f off)\n", elapsed, (int) elapsed, elapsed_usecs, ABS (elapsed - 9.));
+ g_printerr ("\t=> timer = %.6f = %d.%06ld (should be: 9.000000) (%.6f off)\n", elapsed, (int) elapsed, elapsed_usecs, ABS (elapsed - 9.));
g_assert_cmpfloat (elapsed, >, 8.8);
g_assert_cmpfloat (elapsed, <, 9.2);
if (g_test_verbose())
- g_print ("g_timer_continue ... ok\n\n");
+ g_printerr ("g_timer_continue ... ok\n\n");
g_timer_stop (timer2);
elapsed = g_timer_elapsed (timer2, &elapsed_usecs);
if (g_test_verbose())
- g_print ("\t=> timer2 = %.6f = %d.%06ld (should be: %.6f) (%.6f off)\n\n", elapsed, (int) elapsed, elapsed_usecs, 9.+6.5, ABS (elapsed - (9.+6.5)));
+ g_printerr ("\t=> timer2 = %.6f = %d.%06ld (should be: %.6f) (%.6f off)\n\n", elapsed, (int) elapsed, elapsed_usecs, 9.+6.5, ABS (elapsed - (9.+6.5)));
g_assert_cmpfloat (elapsed, >, 8.8 + 6.5);
g_assert_cmpfloat (elapsed, <, 9.2 + 6.5);
if (g_test_verbose())
- g_print ("timer2 ... ok\n\n");
+ g_printerr ("timer2 ... ok\n\n");
g_timer_destroy (timer);
g_timer_destroy (timer2);
}
g_assert_cmpint (sizeof (gint64), ==, 8);
/* endian macros */
if (g_test_verbose())
- g_print ("checking endian macros (host is %s)...\n",
+ g_printerr ("checking endian macros (host is %s)...\n",
G_BYTE_ORDER == G_BIG_ENDIAN ? "big endian" : "little endian");
g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2);
g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2);
const gchar *charset;
gboolean charset_is_utf8;
if (g_test_verbose())
- g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n",
+ g_printerr ("TestGLib v%u.%u.%u (i:%u b:%u)\n",
glib_major_version,
glib_minor_version,
glib_micro_version,
hn = g_get_host_name();
if (g_test_verbose())
{
- g_print ("cwd: %s\n", cwd);
- g_print ("user: %s\n", un);
- g_print ("real: %s\n", rn);
- g_print ("host: %s\n", hn);
+ g_printerr ("cwd: %s\n", cwd);
+ g_printerr ("user: %s\n", un);
+ g_printerr ("real: %s\n", rn);
+ g_printerr ("host: %s\n", hn);
}
g_free (cwd);
if (g_test_verbose())
{
- g_print ("tmp-dir: %s\n", tmpdir);
- g_print ("home: %s\n", homedir);
- g_print ("user_data: %s\n", userdatadir);
- g_print ("user_config: %s\n", uconfdir);
- g_print ("user_cache: %s\n", ucachedir);
- g_print ("user_runtime: %s\n", uruntimedir);
- g_print ("system_data: %s\n", sdatadirs);
- g_print ("system_config: %s\n", sconfdirs);
- g_print ("languages: %s\n", langnames);
- g_print ("user_special[DESKTOP]: %s\n", uddesktop);
- g_print ("user_special[DOCUMENTS]: %s\n", udddocs);
- g_print ("user_special[PUBLIC_SHARE]: %s\n", uddpubshare);
+ g_printerr ("tmp-dir: %s\n", tmpdir);
+ g_printerr ("home: %s\n", homedir);
+ g_printerr ("user_data: %s\n", userdatadir);
+ g_printerr ("user_config: %s\n", uconfdir);
+ g_printerr ("user_cache: %s\n", ucachedir);
+ g_printerr ("user_runtime: %s\n", uruntimedir);
+ g_printerr ("system_data: %s\n", sdatadirs);
+ g_printerr ("system_config: %s\n", sconfdirs);
+ g_printerr ("languages: %s\n", langnames);
+ g_printerr ("user_special[DESKTOP]: %s\n", uddesktop);
+ g_printerr ("user_special[DOCUMENTS]: %s\n", udddocs);
+ g_printerr ("user_special[PUBLIC_SHARE]: %s\n", uddpubshare);
}
g_free (sdatadirs);
g_free (sconfdirs);
if (g_test_verbose())
{
if (charset_is_utf8)
- g_print ("current charset is UTF-8: %s\n", charset);
+ g_printerr ("current charset is UTF-8: %s\n", charset);
else
- g_print ("current charset is not UTF-8: %s\n", charset);
+ g_printerr ("current charset is not UTF-8: %s\n", charset);
}
if (g_test_verbose())
{
#ifdef G_PLATFORM_WIN32
- g_print ("current locale: %s\n", g_win32_getlocale ());
+ g_printerr ("current locale: %s\n", g_win32_getlocale ());
- g_print ("found more.com as %s\n", g_find_program_in_path ("more.com"));
- g_print ("found regedit as %s\n", g_find_program_in_path ("regedit"));
+ g_printerr ("found more.com as %s\n", g_find_program_in_path ("more.com"));
+ g_printerr ("found regedit as %s\n", g_find_program_in_path ("regedit"));
- g_print ("a Win32 error message: %s\n", g_win32_error_message (2));
+ g_printerr ("a Win32 error message: %s\n", g_win32_error_message (2));
#endif
}
}
gchar *string;
guint i;
if (g_test_verbose())
- g_print ("checking g_path_get_basename()...");
+ g_printerr ("checking g_path_get_basename()...");
string = g_path_get_basename (G_DIR_SEPARATOR_S "foo" G_DIR_SEPARATOR_S "dir" G_DIR_SEPARATOR_S);
g_assert (strcmp (string, "dir") == 0);
g_free (string);
g_assert (strcmp (string, "file") == 0);
g_free (string);
if (g_test_verbose())
- g_print ("ok\n");
+ g_printerr ("ok\n");
#ifdef G_OS_WIN32
string = g_path_get_basename ("/foo/dir/");
#endif
if (g_test_verbose())
- g_print ("checking g_path_get_dirname()...");
+ g_printerr ("checking g_path_get_dirname()...");
for (i = 0; i < n_dirname_checks; i++)
{
gchar *dirname = g_path_get_dirname (dirname_checks[i].filename);
g_free (dirname);
}
if (g_test_verbose())
- g_print ("ok\n");
+ g_printerr ("ok\n");
if (g_test_verbose())
- g_print ("checking g_path_skip_root()...");
+ g_printerr ("checking g_path_skip_root()...");
for (i = 0; i < n_skip_root_checks; i++)
{
const gchar *skipped = g_path_skip_root (skip_root_checks[i].filename);
}
}
if (g_test_verbose())
- g_print ("ok\n");
+ g_printerr ("ok\n");
}
static void
strcpy (template, "foobar");
fd = g_mkstemp (template);
if (g_test_verbose() && fd != -1)
- g_print ("g_mkstemp works even if template doesn't end in XXXXXX\n");
+ g_printerr ("g_mkstemp works even if template doesn't end in XXXXXX\n");
if (fd != -1)
close (fd);
strcpy (template, "fooXXXXXX");
if (g_test_verbose())
{
if (fd != -1)
- g_print ("g_file_open_tmp works even if template contains '%s'\n", G_DIR_SEPARATOR_S);
+ g_printerr ("g_file_open_tmp works even if template contains '%s'\n", G_DIR_SEPARATOR_S);
else
- g_print ("g_file_open_tmp correctly returns error: %s\n", error->message);
+ g_printerr ("g_file_open_tmp correctly returns error: %s\n", error->message);
}
if (fd != -1)
close (fd);
if (g_test_verbose())
{
if (fd != -1)
- g_print ("g_file_open_tmp works even if template contains '/'\n");
+ g_printerr ("g_file_open_tmp works even if template contains '/'\n");
else
- g_print ("g_file_open_tmp correctly returns error: %s\n", error->message);
+ g_printerr ("g_file_open_tmp correctly returns error: %s\n", error->message);
}
if (fd != -1)
close (fd);
if (fd == -1)
g_error ("g_file_open_tmp didn't work for template '%s': %s\n", template, error->message);
else if (g_test_verbose())
- g_print ("g_file_open_tmp for template '%s' used name '%s'\n", template, name_used);
+ g_printerr ("g_file_open_tmp for template '%s' used name '%s'\n", template, name_used);
if (fd != -1)
close (fd);
g_clear_error (&error);
guint i;
if (g_test_verbose())
- g_print ("test GString basics\n");
+ g_printerr ("test GString basics\n");
string1 = g_string_new ("hi pete!");
string2 = g_string_new ("");
#endif
if (g_test_verbose())
- g_print ("string2 length = %lu...\n", (gulong)string2->len);
+ g_printerr ("string2 length = %lu...\n", (gulong)string2->len);
string2->str[70] = '\0';
if (g_test_verbose())
- g_print ("first 70 chars:\n%s\n", string2->str);
+ g_printerr ("first 70 chars:\n%s\n", string2->str);
string2->str[141] = '\0';
if (g_test_verbose())
- g_print ("next 70 chars:\n%s\n", string2->str+71);
+ g_printerr ("next 70 chars:\n%s\n", string2->str+71);
string2->str[212] = '\0';
if (g_test_verbose())
- g_print ("and next 70:\n%s\n", string2->str+142);
+ g_printerr ("and next 70:\n%s\n", string2->str+142);
if (g_test_verbose())
- g_print ("last 70 chars:\n%s\n", string2->str+string2->len - 70);
+ g_printerr ("last 70 chars:\n%s\n", string2->str+string2->len - 70);
g_string_free (string1, TRUE);
g_string_free (string2, TRUE);
/* Check handling of embedded ASCII 0 (NUL) characters in GString. */
if (g_test_verbose())
- g_print ("test embedded ASCII 0 (NUL) characters in GString\n");
+ g_printerr ("test embedded ASCII 0 (NUL) characters in GString\n");
string1 = g_string_new ("fiddle");
string2 = g_string_new ("fiddle");
g_assert (g_string_equal(string1, string2));
const gchar *tz;
if (g_test_verbose())
- g_print ("checking string chunks...");
+ g_printerr ("checking string chunks...");
string_chunk = g_string_chunk_new (1024);
for (i = 0; i < 100000; i ++)
{
g_string_chunk_free (string_chunk);
if (g_test_verbose())
- g_print ("test positional printf formats (not supported):");
+ g_printerr ("test positional printf formats (not supported):");
string = g_strdup_printf ("%.*s%s", 5, "a", "b");
tmp_string = g_strdup_printf ("%2$*1$s", 5, "c");
if (g_test_verbose())
- g_print ("%s%s\n", string, tmp_string);
+ g_printerr ("%s%s\n", string, tmp_string);
g_free (tmp_string);
g_free (string);
#define REF_STR_DATE_ONLY "1980-02-22"
if (g_test_verbose())
- g_print ("checking g_time_val_from_iso8601...\n");
+ g_printerr ("checking g_time_val_from_iso8601...\n");
ref_date.tv_sec = REF_SEC_UTC;
ref_date.tv_usec = 0;
g_assert (g_time_val_from_iso8601 (REF_INVALID1, &date) == FALSE);
g_assert (g_time_val_from_iso8601 (REF_STR_DATE_ONLY, &date) == FALSE);
g_assert (g_time_val_from_iso8601 (REF_STR_UTC, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_LOCAL, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> LOCAL stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> LOCAL stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_CEST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_EST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_NST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
ref_date.tv_usec = REF_USEC_UTC;
g_assert (g_time_val_from_iso8601 (REF_STR_USEC_UTC, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_USEC_CEST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_USEC_EST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> EST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
g_assert (g_time_val_from_iso8601 (REF_STR_USEC_NST, &date) != FALSE);
if (g_test_verbose())
- g_print ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ g_printerr ("\t=> NST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
if (g_test_verbose())
- g_print ("checking g_time_val_to_iso8601...\n");
+ g_printerr ("checking g_time_val_to_iso8601...\n");
ref_date.tv_sec = REF_SEC_UTC;
ref_date.tv_usec = 0;
date_str = g_time_val_to_iso8601 (&ref_date);
g_assert (date_str != NULL);
if (g_test_verbose())
- g_print ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_UTC);
+ g_printerr ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_UTC);
g_assert (strcmp (date_str, REF_STR_UTC) == 0);
g_free (date_str);
date_str = g_time_val_to_iso8601 (&ref_date);
g_assert (date_str != NULL);
if (g_test_verbose())
- g_print ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_USEC_UTC);
+ g_printerr ("\t=> date string = %s (should be: %s)\n", date_str, REF_STR_USEC_UTC);
g_assert (strcmp (date_str, REF_STR_USEC_UTC) == 0);
g_free (date_str);
if (g_test_verbose())
- g_print ("checking g_ascii_strcasecmp...");
+ g_printerr ("checking g_ascii_strcasecmp...");
g_assert (g_ascii_strcasecmp ("FroboZZ", "frobozz") == 0);
g_assert (g_ascii_strcasecmp ("frobozz", "frobozz") == 0);
g_assert (g_ascii_strcasecmp ("frobozz", "FROBOZZ") == 0);
g_assert (g_ascii_strcasecmp ("B", "A") > 0);
if (g_test_verbose())
- g_print ("checking g_strdup...\n");
+ g_printerr ("checking g_strdup...\n");
g_assert (g_strdup (NULL) == NULL);
string = g_strdup (GLIB_TEST_STRING);
g_assert (string != NULL);
g_free (string);
if (g_test_verbose())
- g_print ("checking g_strconcat...\n");
+ g_printerr ("checking g_strconcat...\n");
string = g_strconcat (GLIB_TEST_STRING, NULL);
g_assert (string != NULL);
g_assert (strcmp (string, GLIB_TEST_STRING) == 0);
g_free (string);
if (g_test_verbose())
- g_print ("checking g_strlcpy/g_strlcat...");
+ g_printerr ("checking g_strlcpy/g_strlcat...");
/* The following is a torture test for strlcpy/strlcat, with lots of
* checking; normal users wouldn't use them this way!
*/
g_free(string);
if (g_test_verbose())
- g_print ("checking g_strdup_printf...\n");
+ g_printerr ("checking g_strdup_printf...\n");
string = g_strdup_printf ("%05d %-5s", 21, "test");
g_assert (string != NULL);
g_assert (strcmp(string, "00021 test ") == 0);