tests/ : Add tests for 20 and 24 bit ALAC/CAF files.

This commit is contained in:
Erik de Castro Lopo 2012-03-10 10:59:15 +11:00
parent e08812c4cf
commit 8cf1567ac6
4 changed files with 26 additions and 7 deletions

View File

@ -8,6 +8,9 @@
int, float, double) types and the ALAC types (16, 20, 24 and 32 bit). With
this mod, only 4 are needed.
* tests/floating_point_test.tpl tests/write_read_test.(def|tpl)
Add tests for 20 and 24 bit ALAC/CAF files.
2012-02-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac src/sfconfig.h src/sfendian.h

View File

@ -109,6 +109,8 @@ main (int argc, char *argv [])
float_scaled_test ("alac_16.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_16, -90.0) ;
float_scaled_test ("alac_32.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_32, -186.0) ;
float_scaled_test ("alac_24.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_24, -160.0) ;
float_scaled_test ("alac_20.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_20, -134.0) ;
#if HAVE_EXTERNAL_LIBS
float_scaled_test ("flac_8.flac", allow_exit, SF_FALSE, SF_FORMAT_FLAC | SF_FORMAT_PCM_S8, -39.0) ;
@ -163,6 +165,8 @@ main (int argc, char *argv [])
double_scaled_test ("pcm_24.sds", allow_exit, SF_FALSE, SF_FORMAT_SDS | SF_FORMAT_PCM_24, -180.0) ;
double_scaled_test ("alac_16.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_16, -90.0) ;
double_scaled_test ("alac_20.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_20, -134.0) ;
double_scaled_test ("alac_24.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_24, -158.0) ;
double_scaled_test ("alac_32.caf", allow_exit, SF_FALSE, SF_FORMAT_CAF | SF_FORMAT_ALAC_32, -186.0) ;
#if HAVE_EXTERNAL_LIBS

View File

@ -20,6 +20,16 @@ data_type = {
max_error = "0" ;
} ;
data_type = {
type_name = "20bit" ;
data_type = int ;
data_field = i ;
error_func = BIT_20_ERROR ;
format_char = "0x%X" ;
max_val = "(1.0 * 0x7F00000)" ;
max_error = "4096" ;
} ;
data_type = {
type_name = "24bit" ;
data_type = int ;

View File

@ -189,7 +189,8 @@ main (int argc, char **argv)
pcm_test_double ("double_le.caf", SF_ENDIAN_LITTLE | SF_FORMAT_CAF | SF_FORMAT_DOUBLE, SF_FALSE) ;
pcm_test_short ("alac16.caf" , SF_FORMAT_CAF | SF_FORMAT_ALAC_16, SF_FALSE) ;
pcm_test_short ("alac32.caf" , SF_FORMAT_CAF | SF_FORMAT_ALAC_32, SF_FALSE) ;
pcm_test_20bit ("alac20.caf" , SF_FORMAT_CAF | SF_FORMAT_ALAC_20, SF_FALSE) ;
pcm_test_24bit ("alac24.caf" , SF_FORMAT_CAF | SF_FORMAT_ALAC_24, SF_FALSE) ;
pcm_test_int ("alac32.caf" , SF_FORMAT_CAF | SF_FORMAT_ALAC_32, SF_FALSE) ;
/* Lite remove end */
@ -413,6 +414,7 @@ static void create_short_file (const char *filename) ;
#define CHAR_ERROR(x, y) (abs ((x) - (y)) > 255)
#define INT_ERROR(x, y) (((x) - (y)) != 0)
#define BIT_20_ERROR(x, y) (abs ((x) - (y)) > 4095)
#define TRIBYTE_ERROR(x, y) (abs ((x) - (y)) > 255)
#define FLOAT_ERROR(x, y) (fabs ((x) - (y)) > 1e-5)