From b8ece629f1d34a39c7e6b5c3a3fb6e96cfc99f33 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Tue, 29 May 2001 14:55:39 +0000 Subject: [PATCH] Add test case for the g_qsort_with_data func. It works. This fixes bug 2001-05-29 Sebastian Wilhelmi * tests/Makefile.am, tests/qsort-test.c: Add test case for the g_qsort_with_data func. It works. This fixes bug #52605. --- ChangeLog | 3 +++ ChangeLog.pre-2-0 | 3 +++ ChangeLog.pre-2-10 | 3 +++ ChangeLog.pre-2-12 | 3 +++ ChangeLog.pre-2-2 | 3 +++ ChangeLog.pre-2-4 | 3 +++ ChangeLog.pre-2-6 | 3 +++ ChangeLog.pre-2-8 | 3 +++ tests/.cvsignore | 1 + tests/Makefile.am | 2 ++ tests/qsort-test.c | 27 +++++++++++++++++++++++++++ 11 files changed, 54 insertions(+) create mode 100644 tests/qsort-test.c diff --git a/ChangeLog b/ChangeLog index 981c0e1..a47b81f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 981c0e1..a47b81f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,8 @@ 2001-05-29 Sebastian Wilhelmi + * 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. diff --git a/tests/.cvsignore b/tests/.cvsignore index 199aeb0..0b3055b 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -23,6 +23,7 @@ markup-test module-test node-test queue-test +qsort-test rand-test relation-test shell-test diff --git a/tests/Makefile.am b/tests/Makefile.am index 84024fe..2006e5c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 0000000..4e11943 --- /dev/null +++ b/tests/qsort-test.c @@ -0,0 +1,27 @@ +#include + +#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; +} -- 2.7.4