Rename vorbis_test.c -> compression_size_test.c.

This commit is contained in:
Erik de Castro Lopo 2012-06-19 19:53:39 +10:00
parent 86e74209b5
commit 19f326f022
3 changed files with 28 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2012-06-19 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/
Rename vorbis_test.c -> compression_size_test.c so it can be extended to
test FLAC as well.
2012-06-18 Erik de Castro Lopo <erikd AT mega-nerd DOT com> 2012-06-18 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/broadcast.c * src/broadcast.c

View File

@ -14,7 +14,7 @@ check_PROGRAMS = sfversion floating_point_test write_read_test \
pcm_test headerless_test pipe_test benchmark header_test misc_test \ pcm_test headerless_test pipe_test benchmark header_test misc_test \
raw_test string_test multi_file_test dither_test chunk_test \ raw_test string_test multi_file_test dither_test chunk_test \
scale_clip_test win32_test fix_this aiff_rw_test virtual_io_test \ scale_clip_test win32_test fix_this aiff_rw_test virtual_io_test \
locale_test largefile_test win32_ordinal_test ogg_test vorbis_test \ locale_test largefile_test win32_ordinal_test ogg_test compression_size_test \
checksum_test external_libs_test rdwr_test format_check_test $(CPP_TEST) checksum_test external_libs_test rdwr_test format_check_test $(CPP_TEST)
noinst_HEADERS = dft_cmp.h utils.h generate.h noinst_HEADERS = dft_cmp.h utils.h generate.h
@ -140,8 +140,8 @@ virtual_io_test_LDADD = $(top_builddir)/src/libsndfile.la
ogg_test_SOURCES = ogg_test.c utils.c ogg_test_SOURCES = ogg_test.c utils.c
ogg_test_LDADD = $(top_builddir)/src/libsndfile.la ogg_test_LDADD = $(top_builddir)/src/libsndfile.la
vorbis_test_SOURCES = vorbis_test.c utils.c compression_size_test_SOURCES = compression_size_test.c utils.c
vorbis_test_LDADD = $(top_builddir)/src/libsndfile.la compression_size_test_LDADD = $(top_builddir)/src/libsndfile.la
rdwr_test_SOURCES = rdwr_test.c utils.c rdwr_test_SOURCES = rdwr_test.c utils.c
rdwr_test_LDADD = $(top_builddir)/src/libsndfile.la rdwr_test_LDADD = $(top_builddir)/src/libsndfile.la

View File

@ -1,5 +1,5 @@
/* /*
** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com> ** Copyright (C) 2007-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** **
** This program is free software; you can redistribute it and/or modify ** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
@ -106,13 +106,14 @@ vorbis_test (void)
} /* vorbis_test */ } /* vorbis_test */
static void static void
vorbis_quality_test (void) compression_size_test (int format, const char * filename)
{ /* { /*
** Encode two files, one at quality 0.3 and one at quality 0.5 and then ** Encode two files, one at quality 0.3 and one at quality 0.5 and then
** make sure that the quality 0.3 files is the smaller of the two. ** make sure that the quality 0.3 files is the smaller of the two.
*/ */
const char * q3_fname = "q3_vorbis.oga" ; char q3_fname [64] ;
const char * q5_fname = "q5_vorbis.oga" ; char q5_fname [64] ;
char test_name [64] ;
SNDFILE *q3_file, *q5_file ; SNDFILE *q3_file, *q5_file ;
SF_INFO sfinfo ; SF_INFO sfinfo ;
@ -120,12 +121,16 @@ vorbis_quality_test (void)
double quality ; double quality ;
int k ; int k ;
print_test_name (__func__, "q[35]_vorbis.oga") ; snprintf (q3_fname, sizeof (q3_fname), "q3_%s", filename) ;
snprintf (q5_fname, sizeof (q5_fname), "q5_%s", filename) ;
snprintf (test_name, sizeof (test_name), "q[35]_%s", filename) ;
print_test_name (__func__, test_name) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ; memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */ /* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_VORBIS ; sfinfo.format = format ;
sfinfo.channels = 1 ; sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ; sfinfo.samplerate = SAMPLE_RATE ;
@ -158,19 +163,20 @@ vorbis_quality_test (void)
puts ("ok") ; puts ("ok") ;
unlink (q3_fname) ; unlink (q3_fname) ;
unlink (q5_fname) ; unlink (q5_fname) ;
} /* vorbis_quality_test */ } /* compression_size_test */
int int
main (void) main (void)
{ {
if (HAVE_EXTERNAL_LIBS) if (! HAVE_EXTERNAL_LIBS)
{ vorbis_test () ; { puts (" No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ;
vorbis_quality_test () ; return 0 ;
} } ;
else
puts (" No Ogg/Vorbis tests because Ogg/Vorbis support was not compiled in.") ; vorbis_test () ;
compression_size_test (SF_FORMAT_OGG | SF_FORMAT_VORBIS, "vorbis.oga") ;
return 0 ; return 0 ;
} /* main */ } /* main */