mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
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:
parent
68e002beed
commit
b8ece629f1
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2001-05-29 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
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++
|
* 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
|
compiler in configure.in anyway, I added a test, that the GLib
|
||||||
headers can be inclued into a C++ program. This fixes bug #52605.
|
headers can be inclued into a C++ program. This fixes bug #52605.
|
||||||
|
@ -23,6 +23,7 @@ markup-test
|
|||||||
module-test
|
module-test
|
||||||
node-test
|
node-test
|
||||||
queue-test
|
queue-test
|
||||||
|
qsort-test
|
||||||
rand-test
|
rand-test
|
||||||
relation-test
|
relation-test
|
||||||
shell-test
|
shell-test
|
||||||
|
@ -43,6 +43,7 @@ test_programs = \
|
|||||||
module-test \
|
module-test \
|
||||||
node-test \
|
node-test \
|
||||||
queue-test \
|
queue-test \
|
||||||
|
qsort-test \
|
||||||
rand-test \
|
rand-test \
|
||||||
relation-test \
|
relation-test \
|
||||||
shell-test \
|
shell-test \
|
||||||
@ -81,6 +82,7 @@ module_test_LDADD = $(module_LDADD)
|
|||||||
module_test_LDFLAGS = @G_MODULE_LDFLAGS@
|
module_test_LDFLAGS = @G_MODULE_LDFLAGS@
|
||||||
node_test_LDADD = $(progs_LDADD)
|
node_test_LDADD = $(progs_LDADD)
|
||||||
queue_test_LDADD = $(progs_LDADD)
|
queue_test_LDADD = $(progs_LDADD)
|
||||||
|
qsort_test_LDADD = $(progs_LDADD)
|
||||||
rand_test_LDADD = $(progs_LDADD)
|
rand_test_LDADD = $(progs_LDADD)
|
||||||
relation_test_LDADD = $(progs_LDADD)
|
relation_test_LDADD = $(progs_LDADD)
|
||||||
shell_test_LDADD = $(progs_LDADD)
|
shell_test_LDADD = $(progs_LDADD)
|
||||||
|
27
tests/qsort-test.c
Normal file
27
tests/qsort-test.c
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user