1 [+ AutoGen5 template c +]
3 ** Copyright (C) 2010-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
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 2 of the License, or
8 ** (at your option) any later version.
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY ; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #if (HAVE_DECL_S_IRGRP == 0)
34 #include <sf_unistd.h>
37 #if (defined (WIN32) || defined (_WIN32))
47 +]static void rdwr_[+ (get "name") +]_test (const char *filename) ;
54 rdwr_short_test ("rdwr_short.wav") ;
55 rdwr_int_test ("rdwr_int.wav") ;
56 rdwr_float_test ("rdwr_float.wav") ;
57 rdwr_double_test ("rdwr_double.wav") ;
58 rdwr_raw_test ("rdwr_raw.wav") ;
64 /*============================================================================================
65 ** Here are the test functions.
70 rdwr_[+ (get "name") +]_test (const char *filename)
74 [+ (get "type") +] buffer [160] ;
76 print_test_name ("rdwr_[+ (get "name") +]_test", filename) ;
78 memset (buffer, 0, sizeof (buffer)) ;
80 /* Create sound file with no data. */
81 sfinfo.format = SF_FORMAT_WAV | [+ (get "format") +] ;
82 sfinfo.samplerate = 16000 ;
87 frames = ARRAY_LEN (buffer) ;
89 /* Open again for read/write. */
90 file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
92 test_write_[+ (get "name") +]_or_die (file, 0, buffer, frames, __LINE__) ;
94 test_read_[+ (get "name") +]_or_die (file, 0, buffer, frames, __LINE__) ;
101 } /* rdwr_[+ (get "name") +]_test */