2
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
4
** This program is free software; you can redistribute it and/or modify
5
** it under the terms of the GNU General Public License as published by
6
** the Free Software Foundation; either version 2 of the License, or
7
** (at your option) any later version.
9
** This program is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
** GNU General Public License for more details.
14
** You should have received a copy of the GNU General Public License
15
** along with this program; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33
#define BUFFER_SIZE (1<<15)
34
#define SHORT_BUFFER (256)
36
static void error_number_test (void) ;
37
static void error_value_test (void) ;
41
{ error_number_test () ;
48
error_number_test (void)
49
{ const char *noerror, *errstr ;
52
print_test_name ("error_number_test", "") ;
54
noerror = sf_error_number (0) ;
56
for (k = 1 ; k < 300 ; k++)
57
{ errstr = sf_error_number (k) ;
59
/* Test for termination condition. */
60
if (errstr == noerror)
64
if (strstr (errstr, "This is a bug in libsndfile."))
71
} /* error_number_test */
74
error_value_test (void)
75
{ static unsigned char aiff_data [0x1b0] =
76
{ 'F' , 'O' , 'R' , 'M' ,
77
0x00, 0x00, 0x01, 0xA8, /* FORM length */
79
'A' , 'I' , 'F' , 'C' ,
82
const char *filename = "error.aiff" ;
87
print_test_name ("error_value_test", filename) ;
89
dump_data_to_file (filename, aiff_data, sizeof (aiff_data)) ;
91
file = sf_open (filename, SFM_READ, &sfinfo) ;
93
{ printf ("\n\nLine %d : Should not have been able to open this file.\n\n", __LINE__) ;
97
if ((error_num = sf_error (NULL)) <= 1 || error_num > 300)
98
{ printf ("\n\nLine %d : Should not have had an error number of %d.\n\n", __LINE__, error_num) ;
105
} /* error_value_test */
108
** Do not edit or modify anything in this comment block.
109
** The arch-tag line is a file identity tag for the GNU Arch
110
** revision control system.
112
** arch-tag: 799eba74-b505-49d9-89a6-22a7f51a31b4