mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-06 04:00:08 +00:00
New classes UnitTest and UnitTestRunner. Minor updates to VST wrapper. Added a dynamic buffer for win32 midi input.
This commit is contained in:
parent
cac473bb1e
commit
d2b3c283eb
34 changed files with 1871 additions and 481 deletions
|
|
@ -92,4 +92,53 @@ int64 MemoryInputStream::getPosition()
|
|||
return position;
|
||||
}
|
||||
|
||||
|
||||
#if JUCE_UNIT_TESTS
|
||||
|
||||
#include "../../utilities/juce_UnitTest.h"
|
||||
#include "../../core/juce_Random.h"
|
||||
#include "juce_MemoryOutputStream.h"
|
||||
|
||||
class MemoryStreamTests : public UnitTest
|
||||
{
|
||||
public:
|
||||
MemoryStreamTests() : UnitTest ("MemoryInputStream & MemoryOutputStream") {}
|
||||
|
||||
void runTest()
|
||||
{
|
||||
beginTest ("Basics");
|
||||
|
||||
int randomInt = Random::getSystemRandom().nextInt();
|
||||
int64 randomInt64 = Random::getSystemRandom().nextInt64();
|
||||
double randomDouble = Random::getSystemRandom().nextDouble();
|
||||
String randomString;
|
||||
for (int i = 50; --i >= 0;)
|
||||
randomString << (juce_wchar) (Random::getSystemRandom().nextInt() & 0xffff);
|
||||
|
||||
MemoryOutputStream mo;
|
||||
mo.writeInt (randomInt);
|
||||
mo.writeIntBigEndian (randomInt);
|
||||
mo.writeCompressedInt (randomInt);
|
||||
mo.writeString (randomString);
|
||||
mo.writeInt64 (randomInt64);
|
||||
mo.writeInt64BigEndian (randomInt64);
|
||||
mo.writeDouble (randomDouble);
|
||||
mo.writeDoubleBigEndian (randomDouble);
|
||||
|
||||
MemoryInputStream mi (mo.getData(), mo.getDataSize(), false);
|
||||
expect (mi.readInt() == randomInt);
|
||||
expect (mi.readIntBigEndian() == randomInt);
|
||||
expect (mi.readCompressedInt() == randomInt);
|
||||
expect (mi.readString() == randomString);
|
||||
expect (mi.readInt64() == randomInt64);
|
||||
expect (mi.readInt64BigEndian() == randomInt64);
|
||||
expect (mi.readDouble() == randomDouble);
|
||||
expect (mi.readDoubleBigEndian() == randomDouble);
|
||||
}
|
||||
};
|
||||
|
||||
static MemoryStreamTests memoryInputStreamUnitTests;
|
||||
|
||||
#endif
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue