shithub: libsamplerate

Download patch

ref: 873764f598069ffd6574d8a5b6d73860e1d0a9ee
parent: 657ca9fd74946c5c49c73e868196a8a7e662438b
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Mon Aug 24 16:59:09 EDT 2009

tests/termination_test.c : Add test to detect a particular kind of termination error.

--- a/tests/termination_test.c
+++ b/tests/termination_test.c
@@ -27,6 +27,7 @@
 #define	SHORT_BUFFER_LEN	2048
 #define	LONG_BUFFER_LEN		((1 << 16) - 20)
 
+static void simple_test (int converter) ;
 static void stream_test (int converter, double ratio) ;
 static void init_term_test (int converter, double ratio) ;
 
@@ -67,8 +68,36 @@
 
 	puts ("") ;
 
+	simple_test (SRC_SINC_FASTEST) ;
+
 	return 0 ;
 } /* main */
+
+static void
+simple_test (int converter)
+{
+	int ilen = 199030, olen = 1000, error ;
+
+	{
+		float in [ilen] ;
+		float out [olen] ;
+		double ratio = (1.0 * olen) / ilen ;
+		SRC_DATA src_data =
+		{	ratio,
+			in, out,
+			ilen, olen,
+			0, 0, 0
+		} ;
+
+		error = src_simple (&src_data, converter, 1) ;
+		if (error)
+		{	printf ("\n\nLine %d : %s\n\n", __LINE__, src_strerror (error)) ;
+			exit (1) ;
+			} ;
+	} ;
+
+    return ;
+} /* simple_test */
 
 static void
 init_term_test (int converter, double src_ratio)