Git init
[external/libsndfile.git] / tests / header_test.tpl
1 [+ AutoGen5 template c +]
2 /*
3 ** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
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 2 of the License, or
8 ** (at your option) any later version.
9 **
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #include "sfconfig.h"
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #include <sys/stat.h>
27 #include <math.h>
28
29 #if HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
32
33 #if (HAVE_DECL_S_IRGRP == 0)
34 #include <sf_unistd.h>
35 #endif
36
37 #if (defined (WIN32) || defined (_WIN32))
38 #include <io.h>
39 #include <direct.h>
40 #endif
41
42 #include        <sndfile.h>
43
44 #include        "utils.h"
45
46 #define BUFFER_LEN              (1<<10)
47 #define LOG_BUFFER_SIZE 1024
48
49 static void     update_header_test (const char *filename, int typemajor) ;
50
51 [+ FOR data_type
52 +]static void   update_seek_[+ (get "name") +]_test     (const char *filename, int filetype) ;
53 [+ ENDFOR data_type
54 +]
55
56 static void extra_header_test (const char *filename, int filetype) ;
57
58 static void header_shrink_test (const char *filename, int filetype) ;
59
60 /* Force the start of this buffer to be double aligned. Sparc-solaris will
61 ** choke if its not.
62 */
63 static  int     data_out [BUFFER_LEN] ;
64 static  int     data_in [BUFFER_LEN] ;
65
66 int
67 main (int argc, char *argv [])
68 {       int             do_all = 0 ;
69         int             test_count = 0 ;
70
71         if (argc != 2)
72         {       printf ("Usage : %s <test>\n", argv [0]) ;
73                 printf ("    Where <test> is one of the following:\n") ;
74                 printf ("           wav  - test WAV file peak chunk\n") ;
75                 printf ("           aiff - test AIFF file PEAK chunk\n") ;
76                 printf ("           all  - perform all tests\n") ;
77                 exit (1) ;
78                 } ;
79
80         do_all=!strcmp (argv [1], "all") ;
81
82         if (do_all || ! strcmp (argv [1], "wav"))
83         {       update_header_test ("header.wav", SF_FORMAT_WAV) ;
84                 update_seek_short_test ("header_short.wav", SF_FORMAT_WAV) ;
85                 update_seek_int_test ("header_int.wav", SF_FORMAT_WAV) ;
86                 update_seek_float_test ("header_float.wav", SF_FORMAT_WAV) ;
87                 update_seek_double_test ("header_double.wav", SF_FORMAT_WAV) ;
88                 header_shrink_test ("header_shrink.wav", SF_FORMAT_WAV) ;
89                 extra_header_test ("extra.wav", SF_FORMAT_WAV) ;
90
91                 update_header_test ("header.wavex", SF_FORMAT_WAVEX) ;
92                 update_seek_short_test ("header_short.wavex", SF_FORMAT_WAVEX) ;
93                 update_seek_int_test ("header_int.wavex", SF_FORMAT_WAVEX) ;
94                 update_seek_float_test ("header_float.wavex", SF_FORMAT_WAVEX) ;
95                 update_seek_double_test ("header_double.wavex", SF_FORMAT_WAVEX) ;
96                 header_shrink_test ("header_shrink.wavex", SF_FORMAT_WAVEX) ;
97                 extra_header_test ("extra.wavex", SF_FORMAT_WAVEX) ;
98                 test_count++ ;
99                 } ;
100
101         if (do_all || ! strcmp (argv [1], "aiff"))
102         {       update_header_test ("header.aiff", SF_FORMAT_AIFF) ;
103                 update_seek_short_test ("header_short.aiff", SF_FORMAT_AIFF) ;
104                 update_seek_int_test ("header_int.aiff", SF_FORMAT_AIFF) ;
105                 update_seek_float_test ("header_float.aiff", SF_FORMAT_AIFF) ;
106                 update_seek_double_test ("header_double.aiff", SF_FORMAT_AIFF) ;
107                 header_shrink_test ("header_shrink.wav", SF_FORMAT_AIFF) ;
108                 extra_header_test ("extra.aiff", SF_FORMAT_AIFF) ;
109                 test_count++ ;
110                 } ;
111
112         if (do_all || ! strcmp (argv [1], "au"))
113         {       update_header_test ("header.au", SF_FORMAT_AU) ;
114                 update_seek_short_test ("header_short.au", SF_FORMAT_AU) ;
115                 update_seek_int_test ("header_int.au", SF_FORMAT_AU) ;
116                 update_seek_float_test ("header_float.au", SF_FORMAT_AU) ;
117                 update_seek_double_test ("header_double.au", SF_FORMAT_AU) ;
118                 test_count++ ;
119                 } ;
120
121         if (do_all || ! strcmp (argv [1], "caf"))
122         {       update_header_test ("header.caf", SF_FORMAT_CAF) ;
123                 update_seek_short_test ("header_short.caf", SF_FORMAT_CAF) ;
124                 update_seek_int_test ("header_int.caf", SF_FORMAT_CAF) ;
125                 update_seek_float_test ("header_float.caf", SF_FORMAT_CAF) ;
126                 update_seek_double_test ("header_double.caf", SF_FORMAT_CAF) ;
127                 /* extra_header_test ("extra.caf", SF_FORMAT_CAF) ; */
128                 test_count++ ;
129                 } ;
130
131         if (do_all || ! strcmp (argv [1], "nist"))
132         {       update_header_test ("header.nist", SF_FORMAT_NIST) ;
133                 update_seek_short_test ("header_short.nist", SF_FORMAT_NIST) ;
134                 update_seek_int_test ("header_int.nist", SF_FORMAT_NIST) ;
135                 test_count++ ;
136                 } ;
137
138         if (do_all || ! strcmp (argv [1], "paf"))
139         {       update_header_test ("header.paf", SF_FORMAT_PAF) ;
140                 update_seek_short_test ("header_short.paf", SF_FORMAT_PAF) ;
141                 test_count++ ;
142                 } ;
143
144         if (do_all || ! strcmp (argv [1], "ircam"))
145         {       update_header_test ("header.ircam", SF_FORMAT_IRCAM) ;
146                 update_seek_short_test ("header_short.ircam", SF_FORMAT_IRCAM) ;
147                 test_count++ ;
148                 } ;
149
150         if (do_all || ! strcmp (argv [1], "w64"))
151         {       update_header_test ("header.w64", SF_FORMAT_W64) ;
152                 update_seek_short_test ("header_short.w64", SF_FORMAT_W64) ;
153                 update_seek_int_test ("header_int.w64", SF_FORMAT_W64) ;
154                 update_seek_float_test ("header_float.w64", SF_FORMAT_W64) ;
155                 update_seek_double_test ("header_double.w64", SF_FORMAT_W64) ;
156                 test_count++ ;
157                 } ;
158
159         if (do_all || ! strcmp (argv [1], "rf64"))
160         {       update_header_test ("header.rf64", SF_FORMAT_RF64) ;
161                 update_seek_short_test ("header_short.rf64", SF_FORMAT_RF64) ;
162                 update_seek_int_test ("header_int.rf64", SF_FORMAT_RF64) ;
163                 update_seek_float_test ("header_float.rf64", SF_FORMAT_RF64) ;
164                 update_seek_double_test ("header_double.rf64", SF_FORMAT_RF64) ;
165                 test_count++ ;
166                 } ;
167
168         if (do_all || ! strcmp (argv [1], "mat4"))
169         {       update_header_test ("header.mat4", SF_FORMAT_MAT4) ;
170                 update_seek_short_test ("header_short.mat4", SF_FORMAT_MAT4) ;
171                 update_seek_int_test ("header_int.mat4", SF_FORMAT_MAT4) ;
172                 update_seek_float_test ("header_float.mat4", SF_FORMAT_MAT4) ;
173                 update_seek_double_test ("header_double.mat4", SF_FORMAT_MAT4) ;
174                 test_count++ ;
175                 } ;
176
177         if (do_all || ! strcmp (argv [1], "mat5"))
178         {       update_header_test ("header.mat5", SF_FORMAT_MAT5) ;
179                 update_seek_short_test ("header_short.mat5", SF_FORMAT_MAT5) ;
180                 update_seek_int_test ("header_int.mat5", SF_FORMAT_MAT5) ;
181                 update_seek_float_test ("header_float.mat5", SF_FORMAT_MAT5) ;
182                 update_seek_double_test ("header_double.mat5", SF_FORMAT_MAT5) ;
183                 test_count++ ;
184                 } ;
185
186         if (do_all || ! strcmp (argv [1], "pvf"))
187         {       update_header_test ("header.pvf", SF_FORMAT_PVF) ;
188                 update_seek_short_test ("header_short.pvf", SF_FORMAT_PVF) ;
189                 test_count++ ;
190                 } ;
191
192         if (do_all || ! strcmp (argv [1], "avr"))
193         {       update_header_test ("header.avr", SF_FORMAT_AVR) ;
194                 update_seek_short_test ("header_short.avr", SF_FORMAT_AVR) ;
195                 test_count++ ;
196                 } ;
197
198         if (do_all || ! strcmp (argv [1], "htk"))
199         {       update_header_test ("header.htk", SF_FORMAT_HTK) ;
200                 update_seek_short_test ("header_short.htk", SF_FORMAT_HTK) ;
201                 test_count++ ;
202                 } ;
203
204         if (do_all || ! strcmp (argv [1], "svx"))
205         {       update_header_test ("header.svx", SF_FORMAT_SVX) ;
206                 update_seek_short_test ("header_short.svx", SF_FORMAT_SVX) ;
207                 test_count++ ;
208                 } ;
209
210         if (do_all || ! strcmp (argv [1], "voc"))
211         {       update_header_test ("header.voc", SF_FORMAT_VOC) ;
212                 /*-update_seek_short_test ("header_short.voc", SF_FORMAT_VOC) ;-*/
213                 test_count++ ;
214                 } ;
215
216         if (do_all || ! strcmp (argv [1], "sds"))
217         {       update_header_test ("header.sds", SF_FORMAT_SDS) ;
218                 /*-update_seek_short_test ("header_short.sds", SF_FORMAT_SDS) ;-*/
219                 test_count++ ;
220                 } ;
221
222         if (do_all || ! strcmp (argv [1], "mpc2k"))
223         {       update_header_test ("header.mpc", SF_FORMAT_MPC2K) ;
224                 update_seek_short_test ("header_short.mpc", SF_FORMAT_MPC2K) ;
225                 test_count++ ;
226                 } ;
227
228         if (test_count == 0)
229         {       printf ("Mono : ************************************\n") ;
230                 printf ("Mono : *  No '%s' test defined.\n", argv [1]) ;
231                 printf ("Mono : ************************************\n") ;
232                 return 1 ;
233                 } ;
234
235         return 0 ;
236 } /* main */
237
238
239 /*============================================================================================
240 **      Here are the test functions.
241 */
242
243 static void
244 update_header_sub (const char *filename, int typemajor, int write_mode)
245 {       SNDFILE         *outfile, *infile ;
246         SF_INFO         sfinfo ;
247         int                     k, frames ;
248
249         sfinfo.samplerate = 44100 ;
250         sfinfo.format = (typemajor | SF_FORMAT_PCM_16) ;
251         sfinfo.channels = 1 ;
252         sfinfo.frames = 0 ;
253
254         frames = BUFFER_LEN / sfinfo.channels ;
255
256         outfile = test_open_file_or_die (filename, write_mode, &sfinfo, SF_TRUE, __LINE__) ;
257
258         for (k = 0 ; k < BUFFER_LEN ; k++)
259                 data_out [k] = k + 1 ;
260         test_write_int_or_die (outfile, 0, data_out, BUFFER_LEN, __LINE__) ;
261
262         if (typemajor != SF_FORMAT_HTK)
263         {       /* The HTK header is not correct when the file is first written. */
264                 infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
265                 sf_close (infile) ;
266                 } ;
267
268         sf_command (outfile, SFC_UPDATE_HEADER_NOW, NULL, 0) ;
269
270         /*
271         ** Open file and check log buffer for an error. If header update failed
272         ** the the log buffer will contain errors.
273         */
274         infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
275         check_log_buffer_or_die (infile, __LINE__) ;
276
277         if (sfinfo.frames < BUFFER_LEN || sfinfo.frames > BUFFER_LEN + 50)
278         {       printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), BUFFER_LEN) ;
279                 dump_log_buffer (infile) ;
280                 exit (1) ;
281                 } ;
282
283         test_read_int_or_die (infile, 0, data_in, BUFFER_LEN, __LINE__) ;
284         for (k = 0 ; k < BUFFER_LEN ; k++)
285                 if (data_out [k] != k + 1)
286                         printf ("Error : line %d\n", __LINE__) ;
287
288         sf_close (infile) ;
289
290         /* Set auto update on. */
291         sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) ;
292
293         /* Write more data_out. */
294         for (k = 0 ; k < BUFFER_LEN ; k++)
295                 data_out [k] = k + 2 ;
296         test_write_int_or_die (outfile, 0, data_out, BUFFER_LEN, __LINE__) ;
297
298         /* Open file again and make sure no errors in log buffer. */
299         infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
300         check_log_buffer_or_die (infile, __LINE__) ;
301
302         if (sfinfo.frames < 2 * BUFFER_LEN || sfinfo.frames > 2 * BUFFER_LEN + 50)
303         {       printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * BUFFER_LEN) ;
304                 dump_log_buffer (infile) ;
305                 exit (1) ;
306                 } ;
307
308         sf_close (infile) ;
309
310         sf_close (outfile) ;
311
312         unlink (filename) ;
313 } /* update_header_sub */
314
315 static void
316 update_header_test (const char *filename, int typemajor)
317 {
318         print_test_name ("update_header_test", filename) ;
319
320         update_header_sub (filename, typemajor, SFM_WRITE) ;
321         update_header_sub (filename, typemajor, SFM_RDWR) ;
322
323         unlink (filename) ;
324         puts ("ok") ;
325 } /* update_header_test */
326
327 /*==============================================================================
328 */
329
330 [+ FOR data_type
331 +]static void
332 update_seek_[+ (get "name") +]_test     (const char *filename, int filetype)
333 {       SNDFILE *outfile, *infile ;
334         SF_INFO sfinfo ;
335     sf_count_t frames ;
336     [+ (get "name") +] buffer [8] ;
337         int k ;
338
339         print_test_name ("update_seek_[+ (get "name") +]_test", filename) ;
340
341         memset (buffer, 0, sizeof (buffer)) ;
342
343         /* Create sound outfile with no data. */
344         sfinfo.format = filetype | [+ (get "format") +] ;
345         sfinfo.samplerate = 48000 ;
346         sfinfo.channels = 2 ;
347
348         if (sf_format_check (&sfinfo) == SF_FALSE)
349                 sfinfo.channels = 1 ;
350
351         outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
352         sf_close (outfile) ;
353
354         /* Open again for read/write. */
355         outfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
356
357         /*
358         ** In auto header update mode, seeking to the end of the file with
359     ** SEEK_SET will fail from the 2nd seek on.  seeking to 0, SEEK_END
360         ** will seek to 0 anyway
361         */
362         if (sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) == 0)
363     {   printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
364                 exit (1) ;
365                 } ;
366
367         /* Now write some frames. */
368         frames = ARRAY_LEN (buffer) / sfinfo.channels ;
369
370         for (k = 0 ; k < 6 ; k++)
371         {       test_seek_or_die (outfile, k * frames, SEEK_SET, k * frames, sfinfo.channels, __LINE__) ;
372                 test_seek_or_die (outfile, 0, SEEK_END, k * frames, sfinfo.channels, __LINE__) ;
373
374                 /* Open file again and make sure no errors in log buffer. */
375                 infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
376                 check_log_buffer_or_die (infile, __LINE__) ;
377                 sf_close (infile) ;
378
379                 if (sfinfo.frames != k * frames)
380                 {       printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
381                         dump_log_buffer (infile) ;
382                         exit (1) ;
383                         } ;
384
385                 if ((k & 1) == 0)
386                         test_write_[+ (get "name") +]_or_die (outfile, k, buffer, sfinfo.channels * frames, __LINE__) ;
387                 else
388                         test_writef_[+ (get "name") +]_or_die (outfile, k, buffer, frames, __LINE__) ;
389                 } ;
390
391         sf_close (outfile) ;
392         unlink (filename) ;
393
394         puts ("ok") ;
395         return ;
396 } /* update_seek_[+ (get "name") +]_test */
397
398 [+ ENDFOR data_type
399 +]
400
401 static void
402 header_shrink_test (const char *filename, int filetype)
403 {       SNDFILE *outfile, *infile ;
404         SF_INFO sfinfo ;
405         sf_count_t frames ;
406         float buffer [8], bufferin [8] ;
407
408         print_test_name ("header_shrink_test", filename) ;
409
410         memset (&sfinfo, 0, sizeof (sfinfo)) ;
411         sfinfo.samplerate = 44100 ;
412         sfinfo.format = filetype | SF_FORMAT_FLOAT ;
413         sfinfo.channels = 1 ;
414
415         memset (buffer, 0xA0, sizeof (buffer)) ;
416
417         /* Now write some frames. */
418         frames = ARRAY_LEN (buffer) / sfinfo.channels ;
419
420         /* Test the file with extra header data. */
421         outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
422
423         sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
424         sf_command (outfile, SFC_UPDATE_HEADER_NOW, NULL, SF_FALSE) ;
425         sf_command (outfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
426
427         test_writef_float_or_die (outfile, 0, buffer, frames, __LINE__) ;
428         sf_close (outfile) ;
429
430         /* Open again for read. */
431         infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
432
433         test_readf_float_or_die (infile, 0, bufferin, frames, __LINE__) ;
434         sf_close (infile) ;
435
436         compare_float_or_die (buffer, bufferin, frames, __LINE__) ;
437
438         unlink (filename) ;
439         puts ("ok") ;
440         return ;
441 } /* header_shrink_test */
442
443
444 static void
445 extra_header_test (const char *filename, int filetype)
446 {       SNDFILE *outfile, *infile ;
447         SF_INFO sfinfo ;
448     sf_count_t frames ;
449     short buffer [8] ;
450         int k = 0 ;
451
452         print_test_name ("extra_header_test", filename) ;
453
454         sfinfo.samplerate = 44100 ;
455         sfinfo.format = (filetype | SF_FORMAT_PCM_16) ;
456         sfinfo.channels = 1 ;
457
458         memset (buffer, 0xA0, sizeof (buffer)) ;
459
460         /* Now write some frames. */
461         frames = ARRAY_LEN (buffer) / sfinfo.channels ;
462
463         /* Test the file with extra header data. */
464         outfile = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, [+ (tpl-file-line "%2$d") +]) ;
465         sf_set_string (outfile, SF_STR_TITLE, filename) ;
466         test_writef_short_or_die (outfile, k, buffer, frames, [+ (tpl-file-line "%2$d") +]) ;
467         sf_set_string (outfile, SF_STR_COPYRIGHT, "(c) 1980 Erik") ;
468         sf_close (outfile) ;
469
470 #if 1
471         /*
472         **  Erik de Castro Lopo <erikd@mega-nerd.com> May 23 2004.
473         **
474         ** This file has extra string data in the header and therefore cannot
475         ** currently be opened in SFM_RDWR mode. This is fixable, but its in
476         ** a part of the code I don't want to fiddle with until the Ogg/Vorbis
477         ** integration is done.
478         */
479
480         if ((infile = sf_open (filename, SFM_RDWR, &sfinfo)) != NULL)
481         {       printf ("\n\nError : should not be able to open this file in SFM_RDWR.\n\n") ;
482                 exit (1) ;
483                 } ;
484
485         unlink (filename) ;
486         puts ("ok") ;
487         return ;
488 #else
489
490         hexdump_file (filename, 0, 100000) ;
491
492         /* Open again for read/write. */
493         outfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, [+ (tpl-file-line "%2$d") +]) ;
494
495         /*
496         ** In auto header update mode, seeking to the end of the file with
497     ** SEEK_SET will fail from the 2nd seek on.  seeking to 0, SEEK_END
498         ** will seek to 0 anyway
499         */
500         if (sf_command (outfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) == 0)
501     {   printf ("\n\nError : sf_command (SFC_SET_UPDATE_HEADER_AUTO) return error : %s\n\n", sf_strerror (outfile)) ;
502                 exit (1) ;
503                 } ;
504
505         /* Now write some frames. */
506         frames = ARRAY_LEN (buffer) / sfinfo.channels ;
507
508         for (k = 1 ; k < 6 ; k++)
509         {
510                 printf ("\n*** pass %d\n", k) ;
511                 memset (buffer, 0xA0 + k, sizeof (buffer)) ;
512
513
514                 test_seek_or_die (outfile, k * frames, SEEK_SET, k * frames, sfinfo.channels, [+ (tpl-file-line "%2$d") +]) ;
515                 test_seek_or_die (outfile, 0, SEEK_END, k * frames, sfinfo.channels, [+ (tpl-file-line "%2$d") +]) ;
516
517                 /* Open file again and make sure no errors in log buffer. */
518                 if (0)
519                 {       infile = test_open_file_or_die (filename, SFM_READ, &sfinfo, [+ (tpl-file-line "%2$d") +]) ;
520                         check_log_buffer_or_die (infile, [+ (tpl-file-line "%2$d") +]) ;
521                         sf_close (infile) ;
522                         } ;
523
524                 if (sfinfo.frames != k * frames)
525                 {       printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", [+ (tpl-file-line "%2$d") +], SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
526                         dump_log_buffer (infile) ;
527                         exit (1) ;
528                         } ;
529
530                 if ((k & 1) == 0)
531                         test_write_short_or_die (outfile, k, buffer, sfinfo.channels * frames, [+ (tpl-file-line "%2$d") +]) ;
532                 else
533                         test_writef_short_or_die (outfile, k, buffer, frames, [+ (tpl-file-line "%2$d") +]) ;
534                 hexdump_file (filename, 0, 100000) ;
535                 } ;
536
537         sf_close (outfile) ;
538         unlink (filename) ;
539
540         puts ("ok") ;
541         return ;
542 #endif
543 } /* extra_header_test */
544