Add test case for the g_qsort_with_data func. It works. This fixes bug
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>
Tue, 29 May 2001 14:55:39 +0000 (14:55 +0000)
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>
Tue, 29 May 2001 14:55:39 +0000 (14:55 +0000)
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.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/.cvsignore
tests/Makefile.am
tests/qsort-test.c [new file with mode: 0644]

index 981c0e1..a47b81f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 981c0e1..a47b81f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+
        * tests/Makefile.am, tests/cxx-test.C: Now that we check for a C++
        compiler in configure.in anyway, I added a test, that the GLib
        headers can be inclued into a C++ program. This fixes bug #52605.
index 199aeb0..0b3055b 100644 (file)
@@ -23,6 +23,7 @@ markup-test
 module-test
 node-test
 queue-test
+qsort-test
 rand-test
 relation-test
 shell-test
index 84024fe..2006e5c 100644 (file)
@@ -43,6 +43,7 @@ test_programs = \
        module-test     \
        node-test       \
        queue-test      \
+       qsort-test      \
        rand-test       \
        relation-test   \
        shell-test      \
@@ -81,6 +82,7 @@ module_test_LDADD = $(module_LDADD)
 module_test_LDFLAGS = @G_MODULE_LDFLAGS@
 node_test_LDADD = $(progs_LDADD)
 queue_test_LDADD = $(progs_LDADD)
+qsort_test_LDADD = $(progs_LDADD)
 rand_test_LDADD = $(progs_LDADD)
 relation_test_LDADD = $(progs_LDADD)
 shell_test_LDADD = $(progs_LDADD)
diff --git a/tests/qsort-test.c b/tests/qsort-test.c
new file mode 100644 (file)
index 0000000..4e11943
--- /dev/null
@@ -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;
+}