ref: f2e382343880152fc5b34d55aa162d1b25ddf1b7
parent: 1442221b7544833dd6b50beb22135a7e17d85ccf
author: Erik de Castro Lopo <[email protected]>
date: Wed Oct 7 17:51:00 EDT 2009
tests/misc_test.c : Add zero_input_test() from debian bug #506722.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-07 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+
+ * tests/misc_test.c
+ Add zero_input_test() from debian bug #506722.
+
2009-09-16 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* M4/endian.m4
--- a/tests/misc_test.c
+++ b/tests/misc_test.c
@@ -27,6 +27,7 @@
static void name_test (void) ;
static void error_test (void) ;
static void src_ratio_test (void) ;
+static void zero_input_test (int converter) ;
int
main (void)
@@ -42,6 +43,11 @@
src_ratio_test () ;
+ zero_input_test (SRC_ZERO_ORDER_HOLD) ;
+ zero_input_test (SRC_LINEAR) ;
+ zero_input_test (SRC_SINC_FASTEST) ;
+
+ puts ("") ;
return 0 ;
} /* main */
@@ -135,3 +141,35 @@
return ;
} /* error_test */
+
+static void
+zero_input_test (int converter)
+{ SRC_DATA data ;
+ SRC_STATE *state ;
+ float out [100] ;
+ int error ;
+
+ printf (" %s (%-26s) ........ ", __func__, src_get_name (converter)) ;
+ fflush (stdout) ;
+
+ if ((state = src_new (converter, 1, &error)) == NULL)
+ { printf ("\n\nLine %d : src_new failed : %s.\n\n", __LINE__, src_strerror (error)) ;
+ exit (1) ;
+ } ;
+
+ data.data_in = (float *) 0xdeadbeef ;
+ data.input_frames = 0 ;
+ data.data_out = out ;
+ data.output_frames = ARRAY_LEN (out) ;
+ data.end_of_input = 0 ;
+ data.src_ratio = 1.0 ;
+
+ if ((error = src_process (state, &data)))
+ { printf ("\n\nLine %d : src_new failed : %s.\n\n", __LINE__, src_strerror (error)) ;
+ exit (1) ;
+ } ;
+
+ state = src_delete (state) ;
+
+ puts ("ok") ;
+} /* zero_input_test */