gwin32: Remove old win32 codepage ABI compat code
[glib.git] / tests / qsort-test.c
blob67abb23af1de9163e9efe5094c11aae41d554c12
1 #undef G_DISABLE_ASSERT
2 #undef G_LOG_DOMAIN
4 #include <glib.h>
6 #define SIZE 100000
8 guint32 array[SIZE];
10 static gint
11 sort (gconstpointer a, gconstpointer b, gpointer user_data)
13 return *(guint32*)a < *(guint32*)b ? -1 : 1;
16 int
17 main (int argc, char **argv)
19 int i;
21 for (i = 0; i < SIZE; i++)
22 array[i] = g_random_int ();
24 g_qsort_with_data (array, SIZE, sizeof (guint32), sort, NULL);
26 for (i = 0; i < SIZE - 1; i++)
27 g_assert (array[i] <= array[i+1]);
29 /* 0 elements is a valid case */
30 g_qsort_with_data (array, 0, sizeof (guint32), sort, NULL);
32 return 0;