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

Unit test program for the Spatial_Audio_Framework. More...

#include "saf_test.h"

Go to the source code of this file.

Macros

#define RUN_TEST(testfunc)
 A custom Unity RUN_TEST, which calls timerResult() upon exiting each test.
 

Functions

void setUp (void)
 Called before each unit test is executed.
 
void tearDown (void)
 Called after each unit test is executed.
 
static void timerResult (void)
 Displays the time taken to run the current unit test.
 
int main_test (void)
 Main unit testing program.
 

Variables

static tick_t start
 Start time for whole test program.
 
static tick_t start_test
 Start time for the current unit test.
 

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.c.

Macro Definition Documentation

◆ RUN_TEST

#define RUN_TEST ( testfunc)
Value:
UNITY_NEW_TEST(#testfunc) \
if (TEST_PROTECT()) { setUp(); testfunc(); } \
if (TEST_PROTECT() && (!TEST_IS_IGNORED)) {tearDown(); } \
UnityConcludeTest(); timerResult();
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

A custom Unity RUN_TEST, which calls timerResult() upon exiting each test.

Definition at line 67 of file saf_test.c.

Function Documentation

◆ main_test()

int main_test ( void )

Main unit testing program.

Definition at line 73 of file saf_test.c.

◆ setUp()

void setUp ( void )

Called before each unit test is executed.

Definition at line 57 of file saf_test.c.

◆ tearDown()

void tearDown ( void )

Called after each unit test is executed.

Definition at line 59 of file saf_test.c.

◆ timerResult()

static void timerResult ( void )
static

Displays the time taken to run the current unit test.

Definition at line 61 of file saf_test.c.

Variable Documentation

◆ start

tick_t start
static

Start time for whole test program.

Definition at line 54 of file saf_test.c.

◆ start_test

tick_t start_test
static

Start time for the current unit test.

Definition at line 55 of file saf_test.c.