1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Tidied up unit test code layout

This commit is contained in:
ed 2019-04-02 11:07:30 +01:00
parent bfa167a054
commit f3af250ff7
51 changed files with 201 additions and 108 deletions

View file

@ -141,6 +141,8 @@ void ThreadedAnalyticsDestination::EventDispatcher::addToQueue (const AnalyticsE
eventQueue.push_back (event);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -213,7 +215,7 @@ namespace DestinationTestHelpers
struct ThreadedAnalyticsDestinationTests : public UnitTest
{
ThreadedAnalyticsDestinationTests()
: UnitTest ("ThreadedAnalyticsDestination")
: UnitTest ("ThreadedAnalyticsDestination", "Analytics")
{}
void compareEventQueues (const std::deque<AnalyticsDestination::AnalyticsEvent>& a,

View file

@ -557,8 +557,11 @@ int JUCE_CALLTYPE AudioChannelSet::getAmbisonicOrderForNumChannels (int numChann
return (static_cast<float> (ambisonicOrder) == sqrtMinusOne ? ambisonicOrder : -1);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
class AudioChannelSetUnitTest : public UnitTest
{
public:
@ -645,6 +648,7 @@ private:
};
static AudioChannelSetUnitTest audioChannelSetUnitTest;
#endif
} // namespace juce

View file

@ -460,6 +460,7 @@ void AudioDataConverters::deinterleaveSamples (const float* source, float** dest
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1139,6 +1139,7 @@ ScopedNoDenormals::~ScopedNoDenormals() noexcept
#endif
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -344,6 +344,9 @@ void MidiMessageSequence::createControllerUpdatesForTime (int channelNumber, dou
}
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
struct MidiMessageSequenceTest : public UnitTest

View file

@ -159,6 +159,7 @@ MidiBuffer MidiRPNGenerator::generate (int midiChannel,
return buffer;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -371,6 +372,6 @@ private:
static MidiRPNGeneratorTests MidiRPNGeneratorUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -791,6 +791,7 @@ void MPEInstrument::releaseAllNotes()
notes.clear();
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -2286,6 +2287,6 @@ private:
static MPEInstrumentTests MPEInstrumentUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -106,6 +106,7 @@ MidiBuffer MPEMessages::setZoneLayout (MPEZoneLayout layout)
return buffer;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -233,6 +234,6 @@ private:
static MPEMessagesTests MPEMessagesUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -84,6 +84,7 @@ bool MPENote::operator!= (const MPENote& other) const noexcept
return noteID != other.noteID;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -119,6 +120,6 @@ private:
static MPENoteTests MPENoteUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -255,6 +255,7 @@ void MPEChannelRemapper::zeroArrays()
}
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -475,4 +476,5 @@ struct MPEUtilsUnitTests : public UnitTest
static MPEUtilsUnitTests MPEUtilsUnitTests;
#endif
} // namespace juce

View file

@ -82,6 +82,7 @@ bool MPEValue::operator!= (const MPEValue& other) const noexcept
return ! operator== (other);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -165,6 +166,6 @@ private:
static MPEValueTests MPEValueUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -205,6 +205,7 @@ void MPEZoneLayout::checkAndLimitZoneParameters (int minValue, int maxValue,
}
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -382,6 +383,6 @@ public:
static MPEZoneLayoutTests MPEZoneLayoutUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -157,10 +157,14 @@ void MidiOutput::run()
clearAllPendingMessages();
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
class MidiDevicesUnitTests : public UnitTest
{
public:
class MidiDevicesUnitTests : public UnitTest
{
public:
MidiDevicesUnitTests() : UnitTest ("MidiInput/MidiOutput", "MIDI/MPE") {}
void runTest() override
@ -264,9 +268,10 @@ void MidiOutput::run()
#endif
}
};
};
static MidiDevicesUnitTests MidiDevicesUnitTests;
static MidiDevicesUnitTests MidiDevicesUnitTests;
#endif
} // namespace juce

View file

@ -592,8 +592,8 @@ AudioFormatWriter* CoreAudioFormat::createWriterFor (OutputStream*,
return nullptr;
}
//==============================================================================
// Unit tests for Core Audio layout conversions
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1809,6 +1809,8 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai
return slowCopyWavFileWithNewMetadata (wavFile, newMetadata);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -69,9 +69,12 @@ AudioParameterChoice& AudioParameterChoice::operator= (int newValue)
return *this;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
static struct AudioParameterChoiceTests final : public UnitTest
struct AudioParameterChoiceTests : public UnitTest
{
AudioParameterChoiceTests() : UnitTest ("AudioParameterChoice", "AudioProcessor Parameters") {}
@ -112,7 +115,9 @@ static struct AudioParameterChoiceTests final : public UnitTest
}
}
} audioParameterChoiceTests;
};
static AudioParameterChoiceTests audioParameterChoiceTests;
#endif

View file

@ -69,9 +69,12 @@ AudioParameterInt& AudioParameterInt::operator= (int newValue)
return *this;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
static struct AudioParameterIntTests final : public UnitTest
struct AudioParameterIntTests : public UnitTest
{
AudioParameterIntTests() : UnitTest ("AudioParameterInt", "AudioProcessor Parameters") {}
@ -117,7 +120,9 @@ static struct AudioParameterIntTests final : public UnitTest
expectEquals (intParam.get(), 2);
}
}
} audioParameterIntTests;
};
static AudioParameterIntTests audioParameterIntTests;
#endif

View file

@ -740,9 +740,12 @@ AudioProcessorValueTreeState::ButtonAttachment::ButtonAttachment (AudioProcessor
AudioProcessorValueTreeState::ButtonAttachment::~ButtonAttachment() {}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
static struct ParameterAdapterTests final : public UnitTest
struct ParameterAdapterTests : public UnitTest
{
ParameterAdapterTests() : UnitTest ("Parameter Adapter", "AudioProcessor Parameters") {}
@ -812,7 +815,9 @@ static struct ParameterAdapterTests final : public UnitTest
test ({ 0, 7.5 }, "2.5", 2.5);
}
}
} parameterAdapterTests;
};
static ParameterAdapterTests parameterAdapterTests;
namespace
{
@ -832,7 +837,7 @@ inline bool operator!= (const NormalisableRange<ValueType>& a,
}
} // namespace
static class AudioProcessorValueTreeStateTests final : public UnitTest
class AudioProcessorValueTreeStateTests : public UnitTest
{
private:
using Parameter = AudioProcessorValueTreeState::Parameter;
@ -1166,7 +1171,9 @@ public:
expectEquals (listener.id, String (key));
}
}
} audioProcessorValueTreeStateTests;
};
static AudioProcessorValueTreeStateTests audioProcessorValueTreeStateTests;
#endif

View file

@ -155,7 +155,11 @@ bool BlocksVersion::operator>= (const BlocksVersion& other) const
return (*this > other) || (*this == other);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
class BlocksVersionUnitTests : public UnitTest
{
public:
@ -225,6 +229,7 @@ public:
};
static BlocksVersionUnitTests BlocksVersionUnitTests;
#endif
} // namespace juce

View file

@ -166,6 +166,7 @@ AbstractFifo::ScopedRead AbstractFifo::read (int numToRead) noexcept { ret
AbstractFifo::ScopedWrite AbstractFifo::write (int numToWrite) noexcept { return { *this, numToWrite }; }
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1004,6 +1004,7 @@ MemoryMappedFile::MemoryMappedFile (const File& file, const Range<int64>& fileRa
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -76,6 +76,8 @@ bool FileInputStream::setPosition (int64 pos)
return currentPosition == pos;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -538,6 +538,7 @@ Result JSON::parseQuotedString (String::CharPointerType& t, var& result)
return Result::fail ("Not a quoted string!");
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1278,6 +1278,7 @@ uint32 readLittleEndianBitsInBuffer (const void* buffer, uint32 startBit, uint32
return result;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -161,6 +161,8 @@ void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numB
arrayToChange.setBit (startBit + numBits, nextBool());
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -372,6 +372,8 @@ Array<IPAddress> IPAddress::getAllAddresses (bool includeIPv6)
return addresses;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -60,8 +60,9 @@ String NamedPipe::getName() const
// other methods for this class are implemented in the platform-specific files
//==============================================================================
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
class NamedPipeTests : public UnitTest

View file

@ -780,6 +780,8 @@ bool DatagramSocket::setEnablePortReuse (bool enabled)
#pragma warning (pop)
#endif
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -196,6 +196,8 @@ String BufferedInputStream::readString()
return InputStream::readString();
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -95,6 +95,8 @@ void MemoryInputStream::skipNextBytes (int64 numBytesToSkip)
setPosition (getPosition() + numBytesToSkip);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -78,6 +78,8 @@ bool SubregionStream::isExhausted()
return source->isExhausted();
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -179,6 +179,8 @@ juce_wchar CharacterFunctions::getUnicodeCharFromWindows1252Codepage (const uint
return (juce_wchar) lookup[c - 0x80];
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -2300,6 +2300,7 @@ static String serialiseDouble (double input)
return reduceLengthOfFloatString (String (input, numberOfDecimalPlaces));
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -216,6 +216,7 @@ String TextDiff::Change::appliedTo (const String& text) const noexcept
return text.replaceSection (start, length, insertedText);
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -80,6 +80,8 @@ String ChildProcess::readAllProcessOutput()
return result.toString();
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -350,9 +350,11 @@ bool JUCE_CALLTYPE Process::isRunningUnderDebugger() noexcept
return juce_isRunningUnderDebugger();
}
#if JUCE_UNIT_TESTS
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
class AtomicTests : public UnitTest
{
public:

View file

@ -925,6 +925,7 @@ void XmlElement::deleteAllTextElements() noexcept
}
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -154,6 +154,8 @@ bool GZIPCompressorOutputStream::setPosition (int64 /*newPosition*/)
return false;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -298,6 +298,8 @@ bool GZIPDecompressorInputStream::setPosition (int64 newPos)
return true;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -638,6 +638,8 @@ bool ZipFile::Builder::writeToStream (OutputStream& target, double* const progre
return true;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -366,6 +366,8 @@ int BlowFish::unpad (const void* data, size_t size) noexcept
return static_cast<int> (size - static_cast<size_t> (paddingSize));
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -304,6 +304,7 @@ bool MD5::operator== (const MD5& other) const noexcept { return memcmp (result
bool MD5::operator!= (const MD5& other) const noexcept { return ! operator== (other); }
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -623,6 +623,7 @@ bool Whirlpool::operator== (const Whirlpool& other) const noexcept { return mem
bool Whirlpool::operator!= (const Whirlpool& other) const noexcept { return ! operator== (other); }
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1095,6 +1095,8 @@ void ValueTree::Listener::valueTreeChildOrderChanged (ValueTree&, int, int)
void ValueTree::Listener::valueTreeParentChanged (ValueTree&) {}
void ValueTree::Listener::valueTreeRedirected (ValueTree&) {}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS

View file

@ -1260,6 +1260,6 @@ struct GridTests : public UnitTest
static GridTests gridUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -394,6 +394,7 @@ String OSCAddressPattern::toString() const noexcept
return asString;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -780,6 +781,6 @@ public:
static OSCPatternMatcherTests OSCPatternMatcherUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -78,6 +78,7 @@ OSCColour OSCArgument::getColour() const noexcept
return { 0, 0, 0, 0 };
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -242,6 +243,6 @@ public:
static OSCArgumentTests OSCArgumentUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -108,6 +108,8 @@ const OSCBundle& OSCBundle::Element::getBundle() const
return *bundle;
}
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -239,6 +241,6 @@ public:
static OSCBundleElementTests OSCBundleElementUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -86,6 +86,7 @@ void OSCMessage::addBlob (MemoryBlock blob) { arguments.add (OSCArgument
void OSCMessage::addColour (OSCColour colour) { arguments.add (OSCArgument (colour)); }
void OSCMessage::addArgument (OSCArgument arg) { arguments.add (arg); }
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -210,6 +211,6 @@ public:
static OSCMessageTests OSCMessageUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -1188,6 +1188,6 @@ public:
static OSCInputStreamTests OSCInputStreamUnitTests;
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce

View file

@ -332,6 +332,7 @@ bool OSCSender::send (const OSCBundle& bundle) { return pimpl->send (bundle
bool OSCSender::sendToIPAddress (const String& host, int port, const OSCMessage& message) { return pimpl->send (message, host, port); }
bool OSCSender::sendToIPAddress (const String& host, int port, const OSCBundle& bundle) { return pimpl->send (bundle, host, port); }
//==============================================================================
//==============================================================================
#if JUCE_UNIT_TESTS
@ -867,7 +868,6 @@ public:
static OSCRoundTripTests OSCRoundTripUnitTests;
//==============================================================================
#endif // JUCE_UNIT_TESTS
#endif
} // namespace juce