[Scummvm-cvs-logs] SF.net SVN: scummvm:[47938] scummvm/trunk/test/sound/audiostream.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Feb 6 19:25:58 CET 2010
Revision: 47938
http://scummvm.svn.sourceforge.net/scummvm/?rev=47938&view=rev
Author: lordhoto
Date: 2010-02-06 18:25:57 +0000 (Sat, 06 Feb 2010)
Log Message:
-----------
Add test case for partial reads in LoopingAudioStream too.
Modified Paths:
--------------
scummvm/trunk/test/sound/audiostream.h
Modified: scummvm/trunk/test/sound/audiostream.h
===================================================================
--- scummvm/trunk/test/sound/audiostream.h 2010-02-06 18:20:33 UTC (rev 47937)
+++ scummvm/trunk/test/sound/audiostream.h 2010-02-06 18:25:57 UTC (rev 47938)
@@ -74,10 +74,19 @@
TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6);
TS_ASSERT_EQUALS(loop->endOfData(), false);
- // Read the last second
- TS_ASSERT_EQUALS(loop->readBuffer(buffer, secondLength), secondLength);
- TS_ASSERT_EQUALS(memcmp(buffer, sine, secondLength * sizeof(int16)), 0);
+ // Read the last second in two parts
+ const int firstStep = secondLength / 2;
+ const int secondStep = secondLength - firstStep;
+ TS_ASSERT_EQUALS(loop->readBuffer(buffer, firstStep), firstStep);
+ TS_ASSERT_EQUALS(memcmp(buffer, sine, firstStep * sizeof(int16)), 0);
+
+ TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6);
+ TS_ASSERT_EQUALS(loop->endOfData(), false);
+
+ TS_ASSERT_EQUALS(loop->readBuffer(buffer, secondLength), secondStep);
+ TS_ASSERT_EQUALS(memcmp(buffer, sine + firstStep, secondStep * sizeof(int16)), 0);
+
TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)7);
TS_ASSERT_EQUALS(loop->endOfData(), true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list