SAF
Loading...
Searching...
No Matches
saf_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2020-2021 Leo McCormack
3 *
4 * This software is dual-licensed. Please refer to the LICENCE.md file for more
5 * information.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13 * PERFORMANCE OF THIS SOFTWARE.
14 */
15
52#include "saf_test.h"
53
54static tick_t start;
57void setUp(void) { start_test = timer_current(); }
59void tearDown(void) { }
61static void timerResult(void) {
62 printf(" (Time elapsed: %lfs) \n", (double)timer_elapsed(start_test));
63}
64
65#undef RUN_TEST
67#define RUN_TEST(testfunc) UNITY_NEW_TEST(#testfunc) \
68 if (TEST_PROTECT()) { setUp(); testfunc(); } \
69 if (TEST_PROTECT() && (!TEST_IS_IGNORED)) {tearDown(); } \
70 UnityConcludeTest(); timerResult();
71
72/* Main test program */
73int main_test(void) {
74 printf("%s\n", SAF_VERSION_BANNER);
76 printf("Executing the Spatial_Audio_Framework unit testing program");
77#ifdef NDEBUG
78 printf(" (Release):\n");
79#else
80 printf(" (Debug):\n");
81#endif
82
83 /* initialise */
86 UNITY_BEGIN();
87
89
90 /* SAF utilities modules unit tests */
116
117 /* SAF cdf4sap module unit tests */
120
121 /* SAF hoa module unit tests */
124
125 /* SAF sh module unit tests */
140
141 /* SAF hrir module unit tests */
143
144 /* SAF reverb modules unit tests */
147
148 /* SAF vbap modules unit tests */
149
150 /* SAF sofa reader module unit tests */
151#if defined(SAF_ENABLE_SOFA_READER_MODULE)
155#endif /* SAF_ENABLE_SOFA_READER_MODULE */
156
157 /* SAF tracker module unit tests */
158#ifdef SAF_ENABLE_TRACKER_MODULE
160#endif /* SAF_ENABLE_TRACKER_MODULE */
161
162/* SAF HADES module unit tests */
163#if defined(SAF_ENABLE_HADES_MODULE) && defined(SAF_ENABLE_SOFA_READER_MODULE) /* unit tests rely also on SOFA reader */
165#endif /* SAF_ENABLE_HADES_MODULE */
166
167 /* SAF resources unit tests */
173
174 /* SAF examples unit tests */
175#ifdef SAF_ENABLE_EXAMPLES_TESTS
182#endif /* SAF_ENABLE_EXAMPLES_TESTS */
183
184 /* close */
186 printf("\nTotal time elapsed: %lfs", (double)timer_elapsed(start));
187 return UNITY_END();
188}
#define SAF_VERSION_BANNER
The Spatial_Audio_Framework Version and License as a banner.
Definition saf.h:115
#define SAF_EXTERNALS_CONFIGURATION_STRING
Current configuration information.
#define RUN_TEST(testfunc)
A custom Unity RUN_TEST, which calls timerResult() upon exiting each test.
Definition saf_test.c:67
static tick_t start
Start time for whole test program.
Definition saf_test.c:54
void setUp(void)
Called before each unit test is executed.
Definition saf_test.c:57
static void timerResult(void)
Displays the time taken to run the current unit test.
Definition saf_test.c:61
void tearDown(void)
Called after each unit test is executed.
Definition saf_test.c:59
int main_test(void)
Main unit testing program.
Definition saf_test.c:73
static tick_t start_test
Start time for the current unit test.
Definition saf_test.c:55
Unit test program for the Spatial_Audio_Framework.
void test__real2complexSHMtx(void)
Testing the real to complex spherical harmonic conversion, using getSHcomplex() as the reference.
void test__formulate_M_and_Cr(void)
Testing the formulate_M_and_Cr() function, and verifying that the output mixing matrices yield signal...
void test__calculateGridWeights(void)
Test grid weight approximation.
void test__sphPWD(void)
Testing the DoA estimation performance of sphPWD()
void test__saf_fft(void)
Testing the forward and backward complex-complex FFT (saf_fft)
void test__realloc2d_r(void)
Testing the realloc2d_r() function (reallocating 2-D array, while retaining the previous data order; ...
void test__evalIIRTransferFunction(void)
Testing that the magnitudes and phases returned by evalIIRTransferFunction() are numerically similar ...
void test__getSHreal_recur(void)
Testing that the getSHreal_recur() function is somewhat numerically identical to the full-fat getSHre...
void test__getVoronoiWeights(void)
Testing that the weights from the getVoronoiWeights() function sum to 4pi and that the weights are al...
void test__sphericalBesselFunctions(void)
Testing bessel_jn(), bessel_in(), bessel_yn(), and bessel_kn()
void test__truncationEQ(void)
Testing the truncation EQ.
void test__ims_shoebox_RIR(void)
Testing the ims shoebox simulator, when generating room impulse respones (RIRs) from the computed ech...
void test__getSHreal(void)
Testing the orthogonality of the getSHreal() function.
void test__saf_stft_50pc_overlap(void)
Testing for perfect reconstruction of the saf_stft (when configured for 50% window overlap)
void test__butterCoeffs(void)
Testing that the coefficients computed with butterCoeffs() are numerically similar to the "butter" fu...
void test__sortf(void)
Testing the sortf() function (sorting real floating point numbers)
void test__cmplxPairUp(void)
Testing the cmplxPairUp() function (grouping up conjugate symmetric values)
void test__smb_pitchShifter(void)
Testing that the smb_pitchShifter can shift the energy of input spectra by one octave down.
void test__arraySHTmatrices(void)
Testing the arraySHTmatrices() function.
void test__unique_i(void)
Testing that the unique_i() function operates correctly.
void test__getLoudspeakerDecoderMtx(void)
Testing to assure that (given a uniform loudspeaker layout), the SAD, MMD and EPAD decoders are all e...
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_rfft(void)
Testing the forward and backward real-(half)complex FFT (saf_rfft)
void test__getSHreal_part(void)
Testing that the getSHreal_part() function is somewhat numerically identical to the full-fat getSHrea...
void test__cylindricalBesselFunctions(void)
Testing bessel_Jn(), bessel_Yn()
void test__sphESPRIT(void)
Testing the DoA estimation performance of sphESPRIT()
void test__dvf_dvfShelfCoeffs(void)
Test the generation of high shelf coeffs based on shelf gain and fc parameters.
void test__delaunaynd(void)
Testing that the delaunaynd() function can triangulate basic shapes.
void test__malloc6d(void)
Testing that malloc6d() works, and is truely contiguously allocated.
void test__getSHrotMtxReal(void)
Testing the spherical harmonic rotation matrix function getSHrotMtxReal()
void test__sphModalCoeffs(void)
Testing the sphModalCoeffs() function.
void test__afSTFT(void)
Testing the alias-free STFT filterbank (near)-perfect reconstruction performance.
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_ambi_bin(void)
Testing the SAF ambi_bin.h example (this may also serve as a tutorial on how to use it)
void test__formulate_M_and_Cr_cmplx(void)
Testing the formulate_M_and_Cr_cmplx() function, and verifying that the output mixing matrices yield ...
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...
void test__faf_IIRFilterbank(void)
Testing that the faf_IIRFilterbank can reconstruct the original signal power.
void test__checkCondNumberSHTReal(void)
Testing that for T-designs, the condition numbers are all equal to 1.
void test__qmf(void)
Testing the (near)-perfect reconstruction performance of the QMF filterbank.
void test__hades(void)
Test for hades.
void test__gexpm(void)
Testing computing the matrix exponential - comparing the output to that of the "expm" function in Mat...
void test__dvf_interpDVFShelfParams(void)
Test the interpolation of high shelf parameters based on distance and incidence angle parameters.
void test__sortz(void)
Testing the sortz() function (sorting complex double-floating point numbers)
void test__cart2sph(void)
Testing cart2sph() and sph2cart() are reversible.
void test__mysofa_load(void)
Testing the dependency free mysofa SOFA reader.
void test__dvf_calcDVFShelfParams(void)
Calculate high shelf parameters, g0, gInf, fc, from the lookup table coefficients (10 degree steps)
void test__tracker3d(void)
Testing that the particle-filtering based tracker is able to correctly track two simultaneous targets...
void test__saf_example_spreader(void)
Testing the SAF spreader.h example (this may also serve as a tutorial on how to use it)
void test__malloc5d(void)
Testing that malloc5d() works, and is truely contiguously allocated.
void test__getSHcomplex(void)
Testing the orthogonality of the getSHcomplex() function.
void test__malloc4d(void)
Testing that malloc4d() works, and is truely contiguously allocated.
void test__saf_matrixConv(void)
Testing the saf_matrixConv.
void test__sphMUSIC(void)
Testing the DoA estimation performance of sphMUSIC()
void test__saf_sofa_open(void)
Testing the SAF SOFA reader that uses the netcdf library.
void test__ims_shoebox_TD(void)
Testing the ims shoebox simulator, when applying the echograms in the time- domain.
void test__latticeDecorrelator(void)
Testing the performance of the latticeDecorrelator, verifying that the inter- channel cross-correlati...
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_stft_LTI(void)
Testing for perfect reconstruction of the saf_stft (when configured for linear time-invariant (LTI) f...
void test__sofa_comparison(void)
Testing that the two SOFA readers produce the same results.
void test__resampleHRIRs(void)
Testing that resampleHRIRs() is resampling adequately.
void test__quaternion(void)
Testing that quaternion2rotationMatrix() and rotationMatrix2quaternion() are reversible.
uint64_t tick_t
Tick type.
Definition timer.h:35
TIMER_API deltatime_t timer_elapsed(const tick_t t)
TIMER_API tick_t timer_current(void)
TIMER_API int timer_lib_initialize(void)
TIMER_API void timer_lib_shutdown(void)