update test

This commit is contained in:
Glenn Maynard
2006-12-10 04:01:53 +00:00
parent 1da6f85125
commit 3c85a8e3a7
+7 -8
View File
@@ -19,9 +19,8 @@ void ReadData( RageSoundReader *snd,
{ {
if( iFrame != -1 ) if( iFrame != -1 )
snd->SetPosition_Accurate( iFrame ); snd->SetPosition_Accurate( iFrame );
int bytes = frames*snd->GetNumChannels()*sizeof(int16_t); int got = snd->Read( buf, frames );
int got = snd->Read( buf, bytes ); ASSERT_M( got == frames, ssprintf("%i, %i", got, frames) );
ASSERT_M( got == bytes, ssprintf("%i, %i", got, bytes) );
} }
void find( const char *haystack, int hs, const char *needle, int ns ) void find( const char *haystack, int hs, const char *needle, int ns )
@@ -141,8 +140,8 @@ bool test_read( RageSoundReader *snd, const char *expected_data, int frames )
{ {
int bytes = frames * snd->GetNumChannels() * sizeof(int16_t); int bytes = frames * snd->GetNumChannels() * sizeof(int16_t);
char buf[bytes]; char buf[bytes];
int got = snd->Read( buf, bytes ); int got = snd->Read( buf, frames );
ASSERT( got == bytes ); ASSERT( got == frames );
//compare_buffers( (const int16_t *) expected_data, //compare_buffers( (const int16_t *) expected_data,
// (const int16_t *) buf, // (const int16_t *) buf,
@@ -160,8 +159,8 @@ bool test_read( RageSoundReader *snd, const char *expected_data, int frames )
bool must_be_eof( RageSoundReader *snd ) bool must_be_eof( RageSoundReader *snd )
{ {
char buf[4]; char buf[16];
int got = snd->Read( buf, 4 ); int got = snd->Read( buf, 1 );
return got == 0; return got == 0;
} }
@@ -390,7 +389,7 @@ bool RunTests( RageSoundReader *snd, const TestFile &tf )
while(1) while(1)
{ {
char buf[4096]; char buf[4096];
int got = snd->Read( buf, sizeof(buf) ); int got = snd->Read( buf, sizeof(buf) / (snd->GetNumChannels() * sizeof(int16_t)) );
if( got == 0 ) if( got == 0 )
break; break;
} }