Blame block/test.c

Packit 67cb25
/* block/test.c
Packit 67cb25
 * 
Packit 67cb25
 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
Packit 67cb25
 * 
Packit 67cb25
 * This program is free software; you can redistribute it and/or modify
Packit 67cb25
 * it under the terms of the GNU General Public License as published by
Packit 67cb25
 * the Free Software Foundation; either version 3 of the License, or (at
Packit 67cb25
 * your option) any later version.
Packit 67cb25
 * 
Packit 67cb25
 * This program is distributed in the hope that it will be useful, but
Packit 67cb25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 67cb25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 67cb25
 * General Public License for more details.
Packit 67cb25
 * 
Packit 67cb25
 * You should have received a copy of the GNU General Public License
Packit 67cb25
 * along with this program; if not, write to the Free Software
Packit 67cb25
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Packit 67cb25
 */
Packit 67cb25
Packit 67cb25
#include <config.h>
Packit 67cb25
#include <fcntl.h>
Packit 67cb25
#include <stdlib.h>
Packit 67cb25
#include <stdio.h>
Packit 67cb25
#include <gsl/gsl_block.h>
Packit 67cb25
#include <gsl/gsl_ieee_utils.h>
Packit 67cb25
#include <gsl/gsl_test.h>
Packit 67cb25
Packit 67cb25
int status = 0;
Packit 67cb25
Packit 67cb25
#ifndef DESC
Packit 67cb25
#define DESC ""
Packit 67cb25
#endif
Packit 67cb25
Packit 67cb25
#define N 1027
Packit 67cb25
Packit 67cb25
Packit 67cb25
#define BASE_GSL_COMPLEX_LONG
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_complex_source.c"
Packit 67cb25
#if HAVE_PRINTF_LONGDOUBLE
Packit 67cb25
#include "test_complex_io.c"
Packit 67cb25
#endif
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_GSL_COMPLEX_LONG
Packit 67cb25
Packit 67cb25
Packit 67cb25
#define BASE_GSL_COMPLEX
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_complex_source.c"
Packit 67cb25
#include "test_complex_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_GSL_COMPLEX
Packit 67cb25
Packit 67cb25
#define BASE_GSL_COMPLEX_FLOAT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_complex_source.c"
Packit 67cb25
#include "test_complex_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_GSL_COMPLEX_FLOAT
Packit 67cb25
Packit 67cb25
#define BASE_LONG_DOUBLE
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#if HAVE_PRINTF_LONGDOUBLE
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#endif
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_LONG_DOUBLE
Packit 67cb25
Packit 67cb25
#define BASE_DOUBLE
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_DOUBLE
Packit 67cb25
Packit 67cb25
#define BASE_FLOAT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_FLOAT
Packit 67cb25
Packit 67cb25
#define BASE_ULONG
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_ULONG
Packit 67cb25
Packit 67cb25
#define BASE_LONG
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_LONG
Packit 67cb25
Packit 67cb25
#define BASE_UINT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_UINT
Packit 67cb25
Packit 67cb25
#define BASE_INT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_INT
Packit 67cb25
Packit 67cb25
#define BASE_USHORT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_USHORT
Packit 67cb25
Packit 67cb25
#define BASE_SHORT
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_SHORT
Packit 67cb25
Packit 67cb25
#define BASE_UCHAR
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_UCHAR
Packit 67cb25
Packit 67cb25
#define BASE_CHAR
Packit 67cb25
#include "templates_on.h"
Packit 67cb25
#include "test_source.c"
Packit 67cb25
#include "test_io.c"
Packit 67cb25
#include "templates_off.h"
Packit 67cb25
#undef  BASE_CHAR
Packit 67cb25
Packit 67cb25
void my_error_handler (const char *reason, const char *file,
Packit 67cb25
                       int line, int err);
Packit 67cb25
Packit 67cb25
int
Packit 67cb25
main (void)
Packit 67cb25
{
Packit 67cb25
  gsl_ieee_env_setup ();
Packit 67cb25
Packit 67cb25
  test_func ();
Packit 67cb25
  test_float_func ();
Packit 67cb25
  test_long_double_func ();
Packit 67cb25
  test_ulong_func ();
Packit 67cb25
  test_long_func ();
Packit 67cb25
  test_uint_func ();
Packit 67cb25
  test_int_func ();
Packit 67cb25
  test_ushort_func ();
Packit 67cb25
  test_short_func ();
Packit 67cb25
  test_uchar_func ();
Packit 67cb25
  test_char_func ();
Packit 67cb25
  test_complex_func ();
Packit 67cb25
  test_complex_float_func ();
Packit 67cb25
  test_complex_long_double_func ();
Packit 67cb25
Packit 67cb25
  test_text ();
Packit 67cb25
  test_float_text ();
Packit 67cb25
#if HAVE_PRINTF_LONGDOUBLE
Packit 67cb25
  test_long_double_text ();
Packit 67cb25
#endif
Packit 67cb25
  test_ulong_text ();
Packit 67cb25
  test_long_text ();
Packit 67cb25
  test_uint_text ();
Packit 67cb25
  test_int_text ();
Packit 67cb25
  test_ushort_text ();
Packit 67cb25
  test_short_text ();
Packit 67cb25
  test_uchar_text ();
Packit 67cb25
  test_char_text ();
Packit 67cb25
  test_complex_text ();
Packit 67cb25
  test_complex_float_text ();
Packit 67cb25
#if HAVE_PRINTF_LONGDOUBLE
Packit 67cb25
  test_complex_long_double_text ();
Packit 67cb25
#endif
Packit 67cb25
Packit 67cb25
  test_binary ();
Packit 67cb25
  test_float_binary ();
Packit 67cb25
  test_long_double_binary ();
Packit 67cb25
  test_ulong_binary ();
Packit 67cb25
  test_long_binary ();
Packit 67cb25
  test_uint_binary ();
Packit 67cb25
  test_int_binary ();
Packit 67cb25
  test_ushort_binary ();
Packit 67cb25
  test_short_binary ();
Packit 67cb25
  test_uchar_binary ();
Packit 67cb25
  test_char_binary ();
Packit 67cb25
  test_complex_binary ();
Packit 67cb25
  test_complex_float_binary ();
Packit 67cb25
  test_complex_long_double_binary ();
Packit 67cb25
Packit 67cb25
  gsl_set_error_handler (&my_error_handler);
Packit 67cb25
Packit 67cb25
  test_alloc_zero_length ();
Packit 67cb25
  test_float_alloc_zero_length ();
Packit 67cb25
  test_long_double_alloc_zero_length ();
Packit 67cb25
  test_ulong_alloc_zero_length ();
Packit 67cb25
  test_long_alloc_zero_length ();
Packit 67cb25
  test_uint_alloc_zero_length ();
Packit 67cb25
  test_int_alloc_zero_length ();
Packit 67cb25
  test_ushort_alloc_zero_length ();
Packit 67cb25
  test_short_alloc_zero_length ();
Packit 67cb25
  test_uchar_alloc_zero_length ();
Packit 67cb25
  test_char_alloc_zero_length ();
Packit 67cb25
  test_complex_alloc_zero_length ();
Packit 67cb25
  test_complex_float_alloc_zero_length ();
Packit 67cb25
  test_complex_long_double_alloc_zero_length ();
Packit 67cb25
Packit 67cb25
  test_calloc_zero_length ();
Packit 67cb25
  test_float_calloc_zero_length ();
Packit 67cb25
  test_long_double_calloc_zero_length ();
Packit 67cb25
  test_ulong_calloc_zero_length ();
Packit 67cb25
  test_long_calloc_zero_length ();
Packit 67cb25
  test_uint_calloc_zero_length ();
Packit 67cb25
  test_int_calloc_zero_length ();
Packit 67cb25
  test_ushort_calloc_zero_length ();
Packit 67cb25
  test_short_calloc_zero_length ();
Packit 67cb25
  test_uchar_calloc_zero_length ();
Packit 67cb25
  test_char_calloc_zero_length ();
Packit 67cb25
  test_complex_calloc_zero_length ();
Packit 67cb25
  test_complex_float_calloc_zero_length ();
Packit 67cb25
  test_complex_long_double_calloc_zero_length ();
Packit 67cb25
Packit 67cb25
  exit (gsl_test_summary ());
Packit 67cb25
}
Packit 67cb25
Packit 67cb25
void
Packit 67cb25
my_error_handler (const char *reason, const char *file, int line, int err)
Packit 67cb25
{
Packit 67cb25
  if (0)
Packit 67cb25
    printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err);
Packit 67cb25
  status = 1;
Packit 67cb25
}