3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_errno.h>
25 #include <gsl/gsl_test.h>
26 #include <gsl/gsl_heapsort.h>
27 #include <gsl/gsl_sort.h>
28 #include <gsl/gsl_sort_vector.h>
29 #include <gsl/gsl_ieee_utils.h>
31 size_t urand (size_t);
33 #include "test_heapsort.c"
35 #define BASE_LONG_DOUBLE
36 #include "templates_on.h"
37 #include "test_source.c"
38 #include "templates_off.h"
39 #undef BASE_LONG_DOUBLE
42 #include "templates_on.h"
43 #include "test_source.c"
44 #include "templates_off.h"
48 #include "templates_on.h"
49 #include "test_source.c"
50 #include "templates_off.h"
54 #include "templates_on.h"
55 #include "test_source.c"
56 #include "templates_off.h"
60 #include "templates_on.h"
61 #include "test_source.c"
62 #include "templates_off.h"
66 #include "templates_on.h"
67 #include "test_source.c"
68 #include "templates_off.h"
72 #include "templates_on.h"
73 #include "test_source.c"
74 #include "templates_off.h"
78 #include "templates_on.h"
79 #include "test_source.c"
80 #include "templates_off.h"
84 #include "templates_on.h"
85 #include "test_source.c"
86 #include "templates_off.h"
90 #include "templates_on.h"
91 #include "test_source.c"
92 #include "templates_off.h"
96 #include "templates_on.h"
97 #include "test_source.c"
98 #include "templates_off.h"
106 gsl_ieee_env_setup ();
108 /* Test for lengths of 1 ... 31, then 32, 64, 128, 256, ... */
110 for (i = 1; i < 1024; i = (i < 32) ? i + 1 : 2 * i)
113 for (i = 1; i < 1024; i = (i < 32) ? i + 1 : 2 * i)
115 for (s = 1; s < 4; s++)
117 test_sort_vector (i, s);
118 test_sort_vector_float (i, s);
119 test_sort_vector_long_double (i, s);
120 test_sort_vector_ulong (i, s);
121 test_sort_vector_long (i, s);
122 test_sort_vector_uint (i, s);
123 test_sort_vector_int (i, s);
124 test_sort_vector_ushort (i, s);
125 test_sort_vector_short (i, s);
126 test_sort_vector_uchar (i, s);
127 test_sort_vector_char (i, s);
131 exit (gsl_test_summary ());
137 static unsigned long int x = 1;
138 x = (1103515245 * x + 12345) & 0x7fffffffUL;
139 return (size_t) ((x / 2147483648.0) * N);