Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / vector / test.c
1 /* vector/test.c
2  * 
3  * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
4  * 
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.
9  * 
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.
14  * 
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.
18  */
19
20 #include <config.h>
21
22 #if (!GSL_RANGE_CHECK) && defined(HAVE_INLINE)
23 #undef GSL_RANGE_CHECK
24 #define GSL_RANGE_CHECK 1
25 #endif
26
27 #include <stdlib.h>
28 #include <fcntl.h>
29 #include <stdio.h>
30 #include <gsl/gsl_math.h>
31 #include <gsl/gsl_vector.h>
32 #include <gsl/gsl_test.h>
33 #include <gsl/gsl_ieee_utils.h>
34
35 int status = 0;
36
37 #ifndef DESC
38 #define DESC ""
39 #endif
40
41
42 #define BASE_GSL_COMPLEX_LONG
43 #include "templates_on.h"
44 #include "test_complex_source.c"
45 #include "templates_off.h"
46 #undef  BASE_GSL_COMPLEX_LONG
47
48
49 #define BASE_GSL_COMPLEX
50 #include "templates_on.h"
51 #include "test_complex_source.c"
52 #include "templates_off.h"
53 #undef  BASE_GSL_COMPLEX
54
55 #define BASE_GSL_COMPLEX_FLOAT
56 #include "templates_on.h"
57 #include "test_complex_source.c"
58 #include "templates_off.h"
59 #undef  BASE_GSL_COMPLEX_FLOAT
60
61 #define BASE_LONG_DOUBLE
62 #include "templates_on.h"
63 #include "test_source.c"
64 #include "templates_off.h"
65 #undef  BASE_LONG_DOUBLE
66
67 #define BASE_DOUBLE
68 #include "templates_on.h"
69 #include "test_source.c"
70 #include "templates_off.h"
71 #undef  BASE_DOUBLE
72
73 #define BASE_FLOAT
74 #include "templates_on.h"
75 #include "test_source.c"
76 #include "templates_off.h"
77 #undef  BASE_FLOAT
78
79 #define BASE_ULONG
80 #include "templates_on.h"
81 #include "test_source.c"
82 #include "templates_off.h"
83 #undef  BASE_ULONG
84
85 #define BASE_LONG
86 #include "templates_on.h"
87 #include "test_source.c"
88 #include "templates_off.h"
89 #undef  BASE_LONG
90
91 #define BASE_UINT
92 #include "templates_on.h"
93 #include "test_source.c"
94 #include "templates_off.h"
95 #undef  BASE_UINT
96
97 #define BASE_INT
98 #include "templates_on.h"
99 #include "test_source.c"
100 #include "templates_off.h"
101 #undef  BASE_INT
102
103 #define BASE_USHORT
104 #include "templates_on.h"
105 #include "test_source.c"
106 #include "templates_off.h"
107 #undef  BASE_USHORT
108
109 #define BASE_SHORT
110 #include "templates_on.h"
111 #include "test_source.c"
112 #include "templates_off.h"
113 #undef  BASE_SHORT
114
115 #define BASE_UCHAR
116 #include "templates_on.h"
117 #include "test_source.c"
118 #include "templates_off.h"
119 #undef  BASE_UCHAR
120
121 #define BASE_CHAR
122 #include "templates_on.h"
123 #include "test_source.c"
124 #include "templates_off.h"
125 #undef  BASE_CHAR
126
127 void my_error_handler (const char *reason, const char *file,
128                        int line, int err);
129
130 int
131 main (void)
132 {
133   size_t stride, ostride, N;
134
135   gsl_ieee_env_setup ();
136
137   for (N = 10; N < 1024; N = 2*N + 1) 
138     {
139       for (stride = 1; stride < 5 ; stride++)
140         {
141           test_func (stride, N);
142           test_float_func (stride, N);
143           test_long_double_func (stride, N);
144           test_ulong_func (stride, N);
145           test_long_func (stride, N);
146           test_uint_func (stride, N);
147           test_int_func (stride, N);
148           test_ushort_func (stride, N);
149           test_short_func (stride, N);
150           test_uchar_func (stride, N);
151           test_char_func (stride, N);
152
153           test_complex_func (stride, N);
154           test_complex_float_func (stride, N);
155           test_complex_long_double_func (stride, N);
156
157           for (ostride = 1; ostride < 5 ; ostride++)
158             {
159               test_ops (stride, ostride, N);
160               test_float_ops (stride, ostride, N);
161               test_long_double_ops (stride, ostride, N);
162               test_ulong_ops (stride, ostride, N);
163               test_long_ops (stride, ostride, N);
164               test_uint_ops (stride, ostride, N);
165               test_int_ops (stride, ostride, N);
166               test_ushort_ops (stride, ostride, N);
167               test_short_ops (stride, ostride, N);
168               test_uchar_ops (stride, ostride, N);
169               test_char_ops (stride, ostride, N);
170             }              
171
172           test_text (stride, N);
173           test_float_text (stride, N);
174 #if HAVE_PRINTF_LONGDOUBLE
175           test_long_double_text (stride, N);
176 #endif
177           test_ulong_text (stride, N);
178           test_long_text (stride, N);
179           test_uint_text (stride, N);
180           test_int_text (stride, N);
181           test_ushort_text (stride, N);
182           test_short_text (stride, N);
183           test_uchar_text (stride, N);
184           test_char_text (stride, N);
185
186           test_complex_text (stride, N);
187           test_complex_float_text (stride, N);
188 #if HAVE_PRINTF_LONGDOUBLE
189           test_complex_long_double_text (stride, N);
190 #endif
191
192           test_file (stride, N);
193           test_float_file (stride, N);
194           test_long_double_file (stride, N);
195           test_ulong_file (stride, N);
196           test_long_file (stride, N);
197           test_uint_file (stride, N);
198           test_int_file (stride, N);
199           test_ushort_file (stride, N);
200           test_short_file (stride, N);
201           test_uchar_file (stride, N);
202           test_char_file (stride, N);
203           test_complex_file (stride, N);
204           test_complex_float_file (stride, N);
205           test_complex_long_double_file (stride, N);
206         }
207     }
208
209 #if GSL_RANGE_CHECK
210   gsl_set_error_handler (&my_error_handler);
211
212   for (N = 1; N < 1024; N *=2) 
213     {
214       for (stride = 1; stride < 5 ; stride++)
215         {
216           test_trap (stride, N);
217           test_float_trap (stride, N);
218           test_long_double_trap (stride, N);
219           test_ulong_trap (stride, N);
220           test_long_trap (stride, N);
221           test_uint_trap (stride, N);
222           test_int_trap (stride, N);
223           test_ushort_trap (stride, N);
224           test_short_trap (stride, N);
225           test_uchar_trap (stride, N);
226           test_char_trap (stride, N);
227           test_complex_trap (stride, N);
228           test_complex_float_trap (stride, N);
229           test_complex_long_double_trap (stride, N);
230         }
231     }
232 #endif
233
234   exit (gsl_test_summary ());
235 }
236
237 void
238 my_error_handler (const char *reason, const char *file, int line, int err)
239 {
240   if (0)
241     printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err);
242   status = 1;
243 }