Loopback: fix warnings that prevent compilation

Add newline in biquad_filter.c
Add integer assert with tolerance.
This commit is contained in:
Phil Burk 2016-07-26 19:10:23 -07:00
commit cf4ef2ce19
3 changed files with 18 additions and 9 deletions

View file

@ -119,4 +119,4 @@ void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, i
filter->xn2 = xn2;
filter->yn1 = yn1;
filter->yn2 = yn2;
}
}

View 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 );
}

View file

@ -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