Browse Source

DSP: Add "DSP" UnitTest category to dsp module UnitTests

tags/2021-05-28
hogliux 7 years ago
parent
commit
328c0f6593
3 changed files with 15 additions and 4 deletions
  1. +1
    -1
      modules/juce_dsp/frequency/juce_FFT_test.cpp
  2. +1
    -1
      modules/juce_dsp/maths/juce_Matrix_test.cpp
  3. +13
    -2
      modules/juce_dsp/processors/juce_FIRFilter_test.cpp

+ 1
- 1
modules/juce_dsp/frequency/juce_FFT_test.cpp View File

@@ -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)
{ {


+ 1
- 1
modules/juce_dsp/maths/juce_Matrix_test.cpp View File

@@ -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
{ {


+ 13
- 2
modules/juce_dsp/processors/juce_FIRFilter_test.cpp View File

@@ -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…
Cancel
Save