Browse Source

Loopback: fix warnings that prevent compilation

Add newline in biquad_filter.c
Add integer assert with tolerance.
tags/pa_stable_v190600_20161030
Phil Burk 3 years ago
parent
commit
cf4ef2ce19
3 changed files with 18 additions and 9 deletions
  1. 1
    1
      qa/loopback/src/biquad_filter.c
  2. 8
    8
      qa/loopback/src/paqa.c
  3. 9
    0
      qa/loopback/src/qa_tools.h

+ 1
- 1
qa/loopback/src/biquad_filter.c View File

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

+ 8
- 8
qa/loopback/src/paqa.c View File

@@ -890,10 +890,10 @@ static int PaQa_SingleLoopBackTest( UserOptions *userOptions, TestParameters *te
890 890
 	{
891 891
 		printf( "OK" );
892 892
 	}
893
-    
894
-	printf( "\n" );
895
-    
896
-				
893
+
894
+    // Print the # errors so far to make it easier to see where the error occured.
895
+	printf( " - #errs = %d\n", g_testsFailed );
896
+
897 897
 	PaQa_TeardownLoopbackContext( &loopbackContext );
898 898
 	if( numBadChannels > 0 )
899 899
 	{
@@ -1376,25 +1376,25 @@ int TestSampleFormatConversion( void )
1376 1376
 	PaQa_ConvertFromFloat( floatInput, 4, paUInt8, ucharOutput );
1377 1377
 	for( i=0; i<4; i++ )
1378 1378
 	{
1379
-		QA_ASSERT_CLOSE( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
1379
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
1380 1380
 	}
1381 1381
 	
1382 1382
 	PaQa_ConvertFromFloat( floatInput, 4, paInt8, charOutput );
1383 1383
 	for( i=0; i<4; i++ )
1384 1384
 	{
1385
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
1385
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
1386 1386
 	}
1387 1387
 	
1388 1388
 	PaQa_ConvertFromFloat( floatInput, 4, paInt16, shortOutput );
1389 1389
 	for( i=0; i<4; i++ )
1390 1390
 	{
1391
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
1391
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
1392 1392
 	}
1393 1393
 		
1394 1394
 	PaQa_ConvertFromFloat( floatInput, 4, paInt32, intOutput );
1395 1395
 	for( i=0; i<4; i++ )
1396 1396
 	{
1397
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
1397
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
1398 1398
 	}
1399 1399
 	
1400 1400
 	

+ 9
- 0
qa/loopback/src/qa_tools.h View File

@@ -70,5 +70,14 @@ extern int g_testsFailed;
70 70
 	} \
71 71
 	else g_testsPassed++;
72 72
 
73
+#define QA_ASSERT_CLOSE_INT( message, expected, actual, tolerance ) \
74
+    if (abs((expected)-(actual))>(tolerance)) \
75
+    { \
76
+        printf( "%s:%d - ERROR - %s, expected %d, got %d, tol=%d\n", __FILE__, __LINE__, message, ((int)(expected)), ((int)(actual)), ((int)(tolerance)) ); \
77
+        g_testsFailed++; \
78
+        goto error; \
79
+    } \
80
+    else g_testsPassed++;
81
+
73 82
 
74 83
 #endif

Loading…
Cancel
Save