2017-10-12 18:55:48 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
C Test Wrapper
|
|
|
|
|
|
|
|
This wrapper runs the the C unit tests.
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-12-23 01:36:36 +02:00
|
|
|
#ifndef NO_ERROR
|
|
|
|
#include "common/error.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-12 18:55:48 +02:00
|
|
|
#include "common/harnessTest.h"
|
|
|
|
|
2017-12-23 01:36:36 +02:00
|
|
|
#ifndef NO_MEM_CONTEXT
|
|
|
|
#include "common/memContext.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-12 18:55:48 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
C files to be tested
|
|
|
|
|
|
|
|
The files are included directly so the test can see and manipulate variables and functions in the module without the need to extern.
|
|
|
|
If a .c file does not exist for a module then the header file will be included instead.
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
{[C_INCLUDE]}
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
The test code is included directly so it can freely interact with the included C files
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
{[C_TEST_INCLUDE]}
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
main - run the tests
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2017-12-23 05:36:01 +02:00
|
|
|
// Set globals
|
|
|
|
testPathSet("{[C_TEST_PATH]}");
|
|
|
|
|
2017-10-12 18:55:48 +02:00
|
|
|
// Initialize tests
|
|
|
|
// run, selected
|
|
|
|
{[C_TEST_LIST]}
|
|
|
|
|
2017-12-23 01:36:36 +02:00
|
|
|
#ifndef NO_ERROR
|
|
|
|
TRY_BEGIN()
|
|
|
|
{
|
|
|
|
#endif
|
2017-10-12 18:55:48 +02:00
|
|
|
// Run the tests
|
|
|
|
testRun();
|
|
|
|
|
2017-12-23 01:36:36 +02:00
|
|
|
// End test run and make sure all tests completed
|
2017-10-12 18:55:48 +02:00
|
|
|
testComplete();
|
|
|
|
|
2017-11-29 04:44:05 +02:00
|
|
|
printf("\nTESTS COMPLETED SUCCESSFULLY\n");
|
2017-12-23 01:36:36 +02:00
|
|
|
#ifndef NO_ERROR
|
|
|
|
}
|
|
|
|
CATCH_ANY()
|
|
|
|
{
|
|
|
|
fprintf(stderr, "TEST FAILED WITH %s, \"%s\" at %s:%d\n", errorName(), errorMessage(), errorFileName(), errorFileLine());
|
|
|
|
}
|
|
|
|
#ifndef NO_MEM_CONTEXT
|
|
|
|
FINALLY()
|
|
|
|
{
|
|
|
|
memContextFree(memContextTop());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
TRY_END();
|
|
|
|
#endif
|
2017-10-12 18:55:48 +02:00
|
|
|
}
|