SAF
Loading...
Searching...
No Matches
saf_test.h File Reference

Unit test program for the Spatial_Audio_Framework. More...

#include "unity.h"
#include "timer.h"
#include "saf.h"
#include "saf_externals.h"
#include "ambi_bin.h"
#include "ambi_dec.h"
#include "ambi_drc.h"
#include "ambi_enc.h"
#include "ambi_roomsim.h"
#include "array2sh.h"
#include "beamformer.h"
#include "binauraliser.h"
#include "binauraliser_nf.h"
#include "decorrelator.h"
#include "dirass.h"
#include "matrixconv.h"
#include "multiconv.h"
#include "panner.h"
#include "pitch_shifter.h"
#include "powermap.h"
#include "rotator.h"
#include "sldoa.h"
#include "spreader.h"
#include "tvconv.h"

Go to the source code of this file.

Functions

int main_test (void)
 Main unit testing program.
 
void test__cylindricalBesselFunctions (void)
 Testing bessel_Jn(), bessel_Yn()
 
void test__sphericalBesselFunctions (void)
 Testing bessel_jn(), bessel_in(), bessel_yn(), and bessel_kn()
 
void test__cart2sph (void)
 Testing cart2sph() and sph2cart() are reversible.
 
void test__delaunaynd (void)
 Testing that the delaunaynd() function can triangulate basic shapes.
 
void test__quaternion (void)
 Testing that quaternion2rotationMatrix() and rotationMatrix2quaternion() are reversible.
 
void test__saf_stft_50pc_overlap (void)
 Testing for perfect reconstruction of the saf_stft (when configured for 50% window overlap)
 
void test__saf_stft_LTI (void)
 Testing for perfect reconstruction of the saf_stft (when configured for linear time-invariant (LTI) filtering applications)
 
void test__saf_rfft (void)
 Testing the forward and backward real-(half)complex FFT (saf_rfft)
 
void test__saf_fft (void)
 Testing the forward and backward complex-complex FFT (saf_fft)
 
void test__saf_matrixConv (void)
 Testing the saf_matrixConv.
 
void test__qmf (void)
 Testing the (near)-perfect reconstruction performance of the QMF filterbank.
 
void test__smb_pitchShifter (void)
 Testing that the smb_pitchShifter can shift the energy of input spectra by one octave down.
 
void test__sortf (void)
 Testing the sortf() function (sorting real floating point numbers)
 
void test__sortz (void)
 Testing the sortz() function (sorting complex double-floating point numbers)
 
void test__cmplxPairUp (void)
 Testing the cmplxPairUp() function (grouping up conjugate symmetric values)
 
void test__getVoronoiWeights (void)
 Testing that the weights from the getVoronoiWeights() function sum to 4pi and that the weights are all identical for a uniform arrangement of points.
 
void test__unique_i (void)
 Testing that the unique_i() function operates correctly.
 
void test__latticeDecorrelator (void)
 Testing the performance of the latticeDecorrelator, verifying that the inter- channel cross-correlation coefficients are near 0.
 
void test__butterCoeffs (void)
 Testing that the coefficients computed with butterCoeffs() are numerically similar to the "butter" function in Matlab.
 
void test__evalIIRTransferFunction (void)
 Testing that the magnitudes and phases returned by evalIIRTransferFunction() are numerically similar to the "freqz" function in Matlab.
 
void test__faf_IIRFilterbank (void)
 Testing that the faf_IIRFilterbank can reconstruct the original signal power.
 
void test__gexpm (void)
 Testing computing the matrix exponential - comparing the output to that of the "expm" function in Matlab.
 
void test__dvf_calcDVFShelfParams (void)
 Calculate high shelf parameters, g0, gInf, fc, from the lookup table coefficients (10 degree steps)
 
void test__dvf_interpDVFShelfParams (void)
 Test the interpolation of high shelf parameters based on distance and incidence angle parameters.
 
void test__dvf_dvfShelfCoeffs (void)
 Test the generation of high shelf coeffs based on shelf gain and fc parameters.
 
void test__formulate_M_and_Cr (void)
 Testing the formulate_M_and_Cr() function, and verifying that the output mixing matrices yield signals that have the target covariance.
 
void test__formulate_M_and_Cr_cmplx (void)
 Testing the formulate_M_and_Cr_cmplx() function, and verifying that the output mixing matrices yield signals that have the target covariance.
 
void test__getLoudspeakerDecoderMtx (void)
 Testing to assure that (given a uniform loudspeaker layout), the SAD, MMD and EPAD decoders are all equivalent.
 
void test__truncationEQ (void)
 Testing the truncation EQ.
 
void test__getSHreal (void)
 Testing the orthogonality of the getSHreal() function.
 
void test__getSHreal_recur (void)
 Testing that the getSHreal_recur() function is somewhat numerically identical to the full-fat getSHreal() function.
 
void test__getSHreal_part (void)
 Testing that the getSHreal_part() function is somewhat numerically identical to the full-fat getSHreal() function between start and end order.
 
void test__getSHcomplex (void)
 Testing the orthogonality of the getSHcomplex() function.
 
void test__getSHrotMtxReal (void)
 Testing the spherical harmonic rotation matrix function getSHrotMtxReal()
 
void test__real2complexSHMtx (void)
 Testing the real to complex spherical harmonic conversion, using getSHcomplex() as the reference.
 
void test__complex2realSHMtx (void)
 Testing the complex to real spherical harmonic conversion, using getSHreal() as the reference.
 
void test__computeSectorCoeffsEP (void)
 Testing the computeSectorCoeffsEP() and computeVelCoeffsMtx() functions and comparing their output to that of a reference Matlab function.
 
void test__checkCondNumberSHTReal (void)
 Testing that for T-designs, the condition numbers are all equal to 1.
 
void test__calculateGridWeights (void)
 Test grid weight approximation.
 
void test__sphMUSIC (void)
 Testing the DoA estimation performance of sphMUSIC()
 
void test__sphPWD (void)
 Testing the DoA estimation performance of sphPWD()
 
void test__sphESPRIT (void)
 Testing the DoA estimation performance of sphESPRIT()
 
void test__sphModalCoeffs (void)
 Testing the sphModalCoeffs() function.
 
void test__arraySHTmatrices (void)
 Testing the arraySHTmatrices() function.
 
void test__resampleHRIRs (void)
 Testing that resampleHRIRs() is resampling adequately.
 
void test__ims_shoebox_TD (void)
 Testing the ims shoebox simulator, when applying the echograms in the time- domain.
 
void test__ims_shoebox_RIR (void)
 Testing the ims shoebox simulator, when generating room impulse respones (RIRs) from the computed echograms.
 
void test__saf_sofa_open (void)
 Testing the SAF SOFA reader that uses the netcdf library.
 
void test__mysofa_load (void)
 Testing the dependency free mysofa SOFA reader.
 
void test__sofa_comparison (void)
 Testing that the two SOFA readers produce the same results.
 
void test__tracker3d (void)
 Testing that the particle-filtering based tracker is able to correctly track two simultaneous targets.
 
void test__hades (void)
 Test for hades.
 
void test__afSTFT (void)
 Testing the alias-free STFT filterbank (near)-perfect reconstruction performance.
 
void test__realloc2d_r (void)
 Testing the realloc2d_r() function (reallocating 2-D array, while retaining the previous data order; except truncated or extended)
 
void test__malloc4d (void)
 Testing that malloc4d() works, and is truely contiguously allocated.
 
void test__malloc5d (void)
 Testing that malloc5d() works, and is truely contiguously allocated.
 
void test__malloc6d (void)
 Testing that malloc6d() works, and is truely contiguously allocated.
 
void test__saf_example_ambi_bin (void)
 Testing the SAF ambi_bin.h example (this may also serve as a tutorial on how to use it)
 
void test__saf_example_ambi_dec (void)
 Testing the SAF ambi_dec.h example (this may also serve as a tutorial on how to use it)
 
void test__saf_example_ambi_enc (void)
 Testing the SAF ambi_enc.h example (this may also serve as a tutorial on how to use it)
 
void test__saf_example_array2sh (void)
 Testing the SAF array2sh.h example (this may also serve as a tutorial on how to use it)
 
void test__saf_example_rotator (void)
 Testing the SAF rotator.h example (this may also serve as a tutorial on how to use it)
 
void test__saf_example_spreader (void)
 Testing the SAF spreader.h example (this may also serve as a tutorial on how to use it)
 

Detailed Description

Unit test program for the Spatial_Audio_Framework.

New unit tests may be added with the following steps:

1) add a unit test function prototype to the include header: saf_test.h, for example:

void test__descriptiveNameOfNewUnitTest(void);

2) add the source code for the test in the appropriate source file. For example, if the unit test relates to the reverb module, then add the following to test__reverb_module.c

void test__descriptiveNameOfNewUnitTest(void)
{
// Compact usage of the SAF function(s) under test, making use of the
// unity unit test framework. Refer to existing unit tests for
// examples on how to interface with unity, or visit:
// https://github.com/ThrowTheSwitch/Unity
}

3) add a call for the new unit test in the main test source file: saf_test.c for example:

RUN_TEST(test__descriptiveNameOfNewUnitTest);
Author
Leo McCormack
Date
27.04.2020
License
Mixed (module dependent)

Definition in file saf_test.h.

Function Documentation

◆ main_test()

int main_test ( void )

Main unit testing program.

Definition at line 73 of file saf_test.c.

◆ test__afSTFT()

void test__afSTFT ( void )

Testing the alias-free STFT filterbank (near)-perfect reconstruction performance.

Definition at line 27 of file test__resources.c.

◆ test__arraySHTmatrices()

void test__arraySHTmatrices ( void )

Testing the arraySHTmatrices() function.

Definition at line 768 of file test__sh_module.c.

◆ test__butterCoeffs()

void test__butterCoeffs ( void )

Testing that the coefficients computed with butterCoeffs() are numerically similar to the "butter" function in Matlab.

Definition at line 870 of file test__utilities_module.c.

◆ test__calculateGridWeights()

void test__calculateGridWeights ( void )

Test grid weight approximation.

Definition at line 458 of file test__sh_module.c.

◆ test__cart2sph()

void test__cart2sph ( void )

Testing cart2sph() and sph2cart() are reversible.

Definition at line 99 of file test__utilities_module.c.

◆ test__checkCondNumberSHTReal()

void test__checkCondNumberSHTReal ( void )

Testing that for T-designs, the condition numbers are all equal to 1.

Definition at line 421 of file test__sh_module.c.

◆ test__cmplxPairUp()

void test__cmplxPairUp ( void )

Testing the cmplxPairUp() function (grouping up conjugate symmetric values)

Definition at line 638 of file test__utilities_module.c.

◆ test__complex2realSHMtx()

void test__complex2realSHMtx ( void )

Testing the complex to real spherical harmonic conversion, using getSHreal() as the reference.

Definition at line 324 of file test__sh_module.c.

◆ test__computeSectorCoeffsEP()

void test__computeSectorCoeffsEP ( void )

Testing the computeSectorCoeffsEP() and computeVelCoeffsMtx() functions and comparing their output to that of a reference Matlab function.

Definition at line 380 of file test__sh_module.c.

◆ test__cylindricalBesselFunctions()

void test__cylindricalBesselFunctions ( void )

Testing bessel_Jn(), bessel_Yn()

Definition at line 27 of file test__utilities_module.c.

◆ test__delaunaynd()

void test__delaunaynd ( void )

Testing that the delaunaynd() function can triangulate basic shapes.

Definition at line 123 of file test__utilities_module.c.

◆ test__dvf_calcDVFShelfParams()

void test__dvf_calcDVFShelfParams ( void )

Calculate high shelf parameters, g0, gInf, fc, from the lookup table coefficients (10 degree steps)

Definition at line 1304 of file test__utilities_module.c.

◆ test__dvf_dvfShelfCoeffs()

void test__dvf_dvfShelfCoeffs ( void )

Test the generation of high shelf coeffs based on shelf gain and fc parameters.

Definition at line 1398 of file test__utilities_module.c.

◆ test__dvf_interpDVFShelfParams()

void test__dvf_interpDVFShelfParams ( void )

Test the interpolation of high shelf parameters based on distance and incidence angle parameters.

Definition at line 1348 of file test__utilities_module.c.

◆ test__evalIIRTransferFunction()

void test__evalIIRTransferFunction ( void )

Testing that the magnitudes and phases returned by evalIIRTransferFunction() are numerically similar to the "freqz" function in Matlab.

Definition at line 993 of file test__utilities_module.c.

◆ test__faf_IIRFilterbank()

void test__faf_IIRFilterbank ( void )

Testing that the faf_IIRFilterbank can reconstruct the original signal power.

Definition at line 1195 of file test__utilities_module.c.

◆ test__formulate_M_and_Cr()

void test__formulate_M_and_Cr ( void )

Testing the formulate_M_and_Cr() function, and verifying that the output mixing matrices yield signals that have the target covariance.

Definition at line 27 of file test__cdf4sap_module.c.

◆ test__formulate_M_and_Cr_cmplx()

void test__formulate_M_and_Cr_cmplx ( void )

Testing the formulate_M_and_Cr_cmplx() function, and verifying that the output mixing matrices yield signals that have the target covariance.

Definition at line 181 of file test__cdf4sap_module.c.

◆ test__getLoudspeakerDecoderMtx()

void test__getLoudspeakerDecoderMtx ( void )

Testing to assure that (given a uniform loudspeaker layout), the SAD, MMD and EPAD decoders are all equivalent.

Definition at line 27 of file test__hoa_module.c.

◆ test__getSHcomplex()

void test__getSHcomplex ( void )

Testing the orthogonality of the getSHcomplex() function.

Definition at line 143 of file test__sh_module.c.

◆ test__getSHreal()

void test__getSHreal ( void )

Testing the orthogonality of the getSHreal() function.

Definition at line 27 of file test__sh_module.c.

◆ test__getSHreal_part()

void test__getSHreal_part ( void )

Testing that the getSHreal_part() function is somewhat numerically identical to the full-fat getSHreal() function between start and end order.

Definition at line 111 of file test__sh_module.c.

◆ test__getSHreal_recur()

void test__getSHreal_recur ( void )

Testing that the getSHreal_recur() function is somewhat numerically identical to the full-fat getSHreal() function.

Definition at line 84 of file test__sh_module.c.

◆ test__getSHrotMtxReal()

void test__getSHrotMtxReal ( void )

Testing the spherical harmonic rotation matrix function getSHrotMtxReal()

Definition at line 202 of file test__sh_module.c.

◆ test__getVoronoiWeights()

void test__getVoronoiWeights ( void )

Testing that the weights from the getVoronoiWeights() function sum to 4pi and that the weights are all identical for a uniform arrangement of points.

Definition at line 681 of file test__utilities_module.c.

◆ test__gexpm()

void test__gexpm ( void )

Testing computing the matrix exponential - comparing the output to that of the "expm" function in Matlab.

Definition at line 1268 of file test__utilities_module.c.

◆ test__hades()

void test__hades ( void )

Test for hades.

Definition at line 31 of file test__hades_module.c.

◆ test__ims_shoebox_RIR()

void test__ims_shoebox_RIR ( void )

Testing the ims shoebox simulator, when generating room impulse respones (RIRs) from the computed echograms.

Definition at line 27 of file test__reverb_module.c.

◆ test__ims_shoebox_TD()

void test__ims_shoebox_TD ( void )

Testing the ims shoebox simulator, when applying the echograms in the time- domain.

Definition at line 98 of file test__reverb_module.c.

◆ test__latticeDecorrelator()

void test__latticeDecorrelator ( void )

Testing the performance of the latticeDecorrelator, verifying that the inter- channel cross-correlation coefficients are near 0.

Definition at line 768 of file test__utilities_module.c.

◆ test__malloc4d()

void test__malloc4d ( void )

Testing that malloc4d() works, and is truely contiguously allocated.

Definition at line 162 of file test__resources.c.

◆ test__malloc5d()

void test__malloc5d ( void )

Testing that malloc5d() works, and is truely contiguously allocated.

Definition at line 193 of file test__resources.c.

◆ test__malloc6d()

void test__malloc6d ( void )

Testing that malloc6d() works, and is truely contiguously allocated.

Definition at line 227 of file test__resources.c.

◆ test__mysofa_load()

void test__mysofa_load ( void )

Testing the dependency free mysofa SOFA reader.

Definition at line 43 of file test__sofa_reader_module.c.

◆ test__qmf()

void test__qmf ( void )

Testing the (near)-perfect reconstruction performance of the QMF filterbank.

Definition at line 454 of file test__utilities_module.c.

◆ test__quaternion()

void test__quaternion ( void )

Testing that quaternion2rotationMatrix() and rotationMatrix2quaternion() are reversible.

Definition at line 170 of file test__utilities_module.c.

◆ test__real2complexSHMtx()

void test__real2complexSHMtx ( void )

Testing the real to complex spherical harmonic conversion, using getSHcomplex() as the reference.

Definition at line 263 of file test__sh_module.c.

◆ test__realloc2d_r()

void test__realloc2d_r ( void )

Testing the realloc2d_r() function (reallocating 2-D array, while retaining the previous data order; except truncated or extended)

Definition at line 102 of file test__resources.c.

◆ test__resampleHRIRs()

void test__resampleHRIRs ( void )

Testing that resampleHRIRs() is resampling adequately.

Definition at line 27 of file test__hrir_module.c.

◆ test__saf_example_ambi_bin()

void test__saf_example_ambi_bin ( void )

Testing the SAF ambi_bin.h example (this may also serve as a tutorial on how to use it)

Definition at line 29 of file test__examples.c.

◆ test__saf_example_ambi_dec()

void test__saf_example_ambi_dec ( void )

Testing the SAF ambi_dec.h example (this may also serve as a tutorial on how to use it)

Definition at line 112 of file test__examples.c.

◆ test__saf_example_ambi_enc()

void test__saf_example_ambi_enc ( void )

Testing the SAF ambi_enc.h example (this may also serve as a tutorial on how to use it)

Definition at line 195 of file test__examples.c.

◆ test__saf_example_array2sh()

void test__saf_example_array2sh ( void )

Testing the SAF array2sh.h example (this may also serve as a tutorial on how to use it)

Definition at line 268 of file test__examples.c.

◆ test__saf_example_rotator()

void test__saf_example_rotator ( void )

Testing the SAF rotator.h example (this may also serve as a tutorial on how to use it)

Definition at line 360 of file test__examples.c.

◆ test__saf_example_spreader()

void test__saf_example_spreader ( void )

Testing the SAF spreader.h example (this may also serve as a tutorial on how to use it)

Definition at line 445 of file test__examples.c.

◆ test__saf_fft()

void test__saf_fft ( void )

Testing the forward and backward complex-complex FFT (saf_fft)

Definition at line 413 of file test__utilities_module.c.

◆ test__saf_matrixConv()

void test__saf_matrixConv ( void )

Testing the saf_matrixConv.

Definition at line 330 of file test__utilities_module.c.

◆ test__saf_rfft()

void test__saf_rfft ( void )

Testing the forward and backward real-(half)complex FFT (saf_rfft)

Definition at line 374 of file test__utilities_module.c.

◆ test__saf_sofa_open()

void test__saf_sofa_open ( void )

Testing the SAF SOFA reader that uses the netcdf library.

Definition at line 33 of file test__sofa_reader_module.c.

◆ test__saf_stft_50pc_overlap()

void test__saf_stft_50pc_overlap ( void )

Testing for perfect reconstruction of the saf_stft (when configured for 50% window overlap)

Definition at line 207 of file test__utilities_module.c.

◆ test__saf_stft_LTI()

void test__saf_stft_LTI ( void )

Testing for perfect reconstruction of the saf_stft (when configured for linear time-invariant (LTI) filtering applications)

Definition at line 271 of file test__utilities_module.c.

◆ test__smb_pitchShifter()

void test__smb_pitchShifter ( void )

Testing that the smb_pitchShifter can shift the energy of input spectra by one octave down.

Definition at line 520 of file test__utilities_module.c.

◆ test__sofa_comparison()

void test__sofa_comparison ( void )

Testing that the two SOFA readers produce the same results.

Definition at line 52 of file test__sofa_reader_module.c.

◆ test__sortf()

void test__sortf ( void )

Testing the sortf() function (sorting real floating point numbers)

Definition at line 560 of file test__utilities_module.c.

◆ test__sortz()

void test__sortz ( void )

Testing the sortz() function (sorting complex double-floating point numbers)

Definition at line 592 of file test__utilities_module.c.

◆ test__sphericalBesselFunctions()

void test__sphericalBesselFunctions ( void )

Testing bessel_jn(), bessel_in(), bessel_yn(), and bessel_kn()

Definition at line 54 of file test__utilities_module.c.

◆ test__sphESPRIT()

void test__sphESPRIT ( void )

Testing the DoA estimation performance of sphESPRIT()

Definition at line 623 of file test__sh_module.c.

◆ test__sphModalCoeffs()

void test__sphModalCoeffs ( void )

Testing the sphModalCoeffs() function.

Definition at line 722 of file test__sh_module.c.

◆ test__sphMUSIC()

void test__sphMUSIC ( void )

Testing the DoA estimation performance of sphMUSIC()

Definition at line 486 of file test__sh_module.c.

◆ test__sphPWD()

void test__sphPWD ( void )

Testing the DoA estimation performance of sphPWD()

Definition at line 561 of file test__sh_module.c.

◆ test__tracker3d()

void test__tracker3d ( void )

Testing that the particle-filtering based tracker is able to correctly track two simultaneous targets.

Definition at line 31 of file test__tracker_module.c.

◆ test__truncationEQ()

void test__truncationEQ ( void )

Testing the truncation EQ.

Definition at line 106 of file test__hoa_module.c.

◆ test__unique_i()

void test__unique_i ( void )

Testing that the unique_i() function operates correctly.

Definition at line 736 of file test__utilities_module.c.