]> Repos - portaudio/commitdiff
Loopback: fix warnings that prevent compilation
authorPhil Burk <philburk@mobileer.com>
Wed, 27 Jul 2016 02:10:23 +0000 (19:10 -0700)
committerPhil Burk <philburk@mobileer.com>
Wed, 27 Jul 2016 02:10:23 +0000 (19:10 -0700)
Add newline in biquad_filter.c
Add integer assert with tolerance.

qa/loopback/src/biquad_filter.c
qa/loopback/src/paqa.c
qa/loopback/src/qa_tools.h

index 0566085a610871aac71be0f6406f0cb63dc1298d..1bc4a232ab62995bd6a080822ed330b1105bae3b 100755 (executable)
@@ -119,4 +119,4 @@ void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, i
        filter->xn2 = xn2;
        filter->yn1 = yn1;
        filter->yn2 = yn2;              
-}
\ No newline at end of file
+}
index ad654dbe1eaa2639f691fdb8c42de88f54aa8882..cb7100d7807a8b83cd648550c64cc825cf95d095 100644 (file)
@@ -890,10 +890,10 @@ static int PaQa_SingleLoopBackTest( UserOptions *userOptions, TestParameters *te
        {
                printf( "OK" );
        }
-    
-       printf( "\n" );
-    
-                               
+
+    // Print the # errors so far to make it easier to see where the error occured.
+       printf( " - #errs = %d\n", g_testsFailed );
+
        PaQa_TeardownLoopbackContext( &loopbackContext );
        if( numBadChannels > 0 )
        {
@@ -1376,25 +1376,25 @@ int TestSampleFormatConversion( void )
        PaQa_ConvertFromFloat( floatInput, 4, paUInt8, ucharOutput );
        for( i=0; i<4; i++ )
        {
-               QA_ASSERT_CLOSE( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
+               QA_ASSERT_CLOSE_INT( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
        }
        
        PaQa_ConvertFromFloat( floatInput, 4, paInt8, charOutput );
        for( i=0; i<4; i++ )
        {
-               QA_ASSERT_CLOSE( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
+               QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
        }
        
        PaQa_ConvertFromFloat( floatInput, 4, paInt16, shortOutput );
        for( i=0; i<4; i++ )
        {
-               QA_ASSERT_CLOSE( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
+               QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
        }
                
        PaQa_ConvertFromFloat( floatInput, 4, paInt32, intOutput );
        for( i=0; i<4; i++ )
        {
-               QA_ASSERT_CLOSE( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
+               QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
        }
        
        
index 1f33224fe6ac9f90f1c3d2fd4a14c1ce2e6adaf7..320236e907fcd26996c03775461be75b93f250b3 100755 (executable)
@@ -70,5 +70,14 @@ extern int g_testsFailed;
        } \
        else g_testsPassed++;
 
+#define QA_ASSERT_CLOSE_INT( message, expected, actual, tolerance ) \
+    if (abs((expected)-(actual))>(tolerance)) \
+    { \
+        printf( "%s:%d - ERROR - %s, expected %d, got %d, tol=%d\n", __FILE__, __LINE__, message, ((int)(expected)), ((int)(actual)), ((int)(tolerance)) ); \
+        g_testsFailed++; \
+        goto error; \
+    } \
+    else g_testsPassed++;
+
 
 #endif