Add test case for the g_qsort_with_data func. It works. This fixes bug

2001-05-29  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* tests/Makefile.am, tests/qsort-test.c: Add test case for the
	g_qsort_with_data func. It works. This fixes bug #52605.
This commit is contained in:
Sebastian Wilhelmi
2001-05-29 14:55:39 +00:00
committed by Sebastian Wilhelmi
parent 68e002beed
commit b8ece629f1
11 changed files with 54 additions and 0 deletions

27
tests/qsort-test.c Normal file
View File

@@ -0,0 +1,27 @@
#include <glib.h>
#define SIZE 100000
guint32 array[SIZE];
static gint
sort (gconstpointer a, gconstpointer b, gpointer user_data)
{
return *(guint32*)a < *(guint32*)b ? -1 : 1;
}
int
main ()
{
int i;
for (i = 0; i < SIZE; i++)
array[i] = g_random_int ();
g_qsort_with_data (array, SIZE, sizeof (guint32), sort, NULL);
for (i = 0; i < SIZE - 1; i++)
g_assert (array[i] <= array[i+1]);
return 0;
}