mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
DSP: Add "DSP" UnitTest category to dsp module UnitTests
This commit is contained in:
parent
eb8400b366
commit
328c0f6593
3 changed files with 15 additions and 4 deletions
|
|
@ -31,7 +31,7 @@ namespace dsp
|
||||||
|
|
||||||
struct FFTUnitTest : public UnitTest
|
struct FFTUnitTest : public UnitTest
|
||||||
{
|
{
|
||||||
FFTUnitTest() : UnitTest("FFT") {}
|
FFTUnitTest() : UnitTest ("FFT", "DSP") {}
|
||||||
|
|
||||||
static void fillRandom (Random& random, Complex<float>* buffer, size_t n)
|
static void fillRandom (Random& random, Complex<float>* buffer, size_t n)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace dsp
|
||||||
|
|
||||||
struct LinearAlgebraUnitTest : public UnitTest
|
struct LinearAlgebraUnitTest : public UnitTest
|
||||||
{
|
{
|
||||||
LinearAlgebraUnitTest() : UnitTest("Linear Algebra UnitTests") {}
|
LinearAlgebraUnitTest() : UnitTest ("Linear Algebra UnitTests", "DSP") {}
|
||||||
|
|
||||||
struct AdditionTest
|
struct AdditionTest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ class FIRFilterTest : public UnitTest
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if JUCE_USE_SIMD
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct Helpers<SIMDRegister<Type>>
|
struct Helpers<SIMDRegister<Type>>
|
||||||
{
|
{
|
||||||
|
|
@ -65,6 +66,7 @@ class FIRFilterTest : public UnitTest
|
||||||
n * SIMDRegister<Type>::size());
|
n * SIMDRegister<Type>::size());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static void fillRandom (Random& random, Type* buffer, size_t n) { Helpers<Type>::fillRandom (random, buffer, n); }
|
static void fillRandom (Random& random, Type* buffer, size_t n) { Helpers<Type>::fillRandom (random, buffer, n); }
|
||||||
|
|
@ -85,8 +87,15 @@ class FIRFilterTest : public UnitTest
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapBlock<SampleType> scratchBuffer (numCoefficients
|
HeapBlock<SampleType> scratchBuffer (numCoefficients
|
||||||
+ (SIMDRegister<NumericType>::SIMDRegisterSize / sizeof (SampleType)));
|
#if JUCE_USE_SIMD
|
||||||
|
+ (SIMDRegister<NumericType>::SIMDRegisterSize / sizeof (SampleType))
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
#if JUCE_USE_SIMD
|
||||||
SampleType* buffer = reinterpret_cast<SampleType*> (SIMDRegister<NumericType>::getNextSIMDAlignedPtr (reinterpret_cast<NumericType*> (scratchBuffer.getData())));
|
SampleType* buffer = reinterpret_cast<SampleType*> (SIMDRegister<NumericType>::getNextSIMDAlignedPtr (reinterpret_cast<NumericType*> (scratchBuffer.getData())));
|
||||||
|
#else
|
||||||
|
SampleType* buffer = scratchBuffer.getData();
|
||||||
|
#endif
|
||||||
|
|
||||||
zeromem (buffer, sizeof (SampleType) * numCoefficients);
|
zeromem (buffer, sizeof (SampleType) * numCoefficients);
|
||||||
|
|
||||||
|
|
@ -188,13 +197,15 @@ class FIRFilterTest : public UnitTest
|
||||||
|
|
||||||
runTestForType<TheTest, float, float> ();
|
runTestForType<TheTest, float, float> ();
|
||||||
runTestForType<TheTest, double, double>();
|
runTestForType<TheTest, double, double>();
|
||||||
|
#if JUCE_USE_SIMD
|
||||||
runTestForType<TheTest, SIMDRegister<float>, float> ();
|
runTestForType<TheTest, SIMDRegister<float>, float> ();
|
||||||
runTestForType<TheTest, SIMDRegister<double>, double>();
|
runTestForType<TheTest, SIMDRegister<double>, double>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FIRFilterTest() : UnitTest ("FIR Filter") {}
|
FIRFilterTest() : UnitTest ("FIR Filter", "DSP") {}
|
||||||
|
|
||||||
void runTest() override
|
void runTest() override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue