zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_test_harness.h File Reference
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Classes

struct  SDLTest_TestCaseReference
 
struct  SDLTest_TestSuiteReference
 

Macros

#define TEST_ABORTED   -1
 
#define TEST_COMPLETED   1
 
#define TEST_DISABLED   0
 
#define TEST_ENABLED   1
 
#define TEST_RESULT_FAILED   1
 
#define TEST_RESULT_NO_ASSERT   2
 
#define TEST_RESULT_PASSED   0
 
#define TEST_RESULT_SETUP_FAILURE   4
 
#define TEST_RESULT_SKIPPED   3
 
#define TEST_SKIPPED   2
 
#define TEST_STARTED   0
 

Typedefs

typedef int(* SDLTest_TestCaseFp )(void *arg)
 
typedef struct
SDLTest_TestCaseReference 
SDLTest_TestCaseReference
 
typedef void(* SDLTest_TestCaseSetUpFp )(void *arg)
 
typedef void(* SDLTest_TestCaseTearDownFp )(void *arg)
 
typedef struct
SDLTest_TestSuiteReference 
SDLTest_TestSuiteReference
 

Functions

int SDLTest_RunSuites (SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations)
 Execute a test suite using the given run seed and execution key. More...
 

Detailed Description

Include file for SDL test framework.

This code is a part of the SDL2_test library, not the main SDL library.

Definition in file SDL_test_harness.h.

Macro Definition Documentation

#define TEST_ABORTED   -1

Definition at line 51 of file SDL_test_harness.h.

Referenced by SDLTest_BailOut(), and SDLTest_RunTest().

#define TEST_COMPLETED   1

Definition at line 53 of file SDL_test_harness.h.

#define TEST_DISABLED   0

Definition at line 48 of file SDL_test_harness.h.

#define TEST_ENABLED   1

Definition at line 47 of file SDL_test_harness.h.

#define TEST_RESULT_FAILED   1
#define TEST_RESULT_NO_ASSERT   2

Definition at line 59 of file SDL_test_harness.h.

Referenced by SDLTest_AssertSummaryToTestResult(), and SDLTest_RunSuites().

#define TEST_RESULT_PASSED   0

Definition at line 57 of file SDL_test_harness.h.

Referenced by SDLTest_AssertSummaryToTestResult(), and SDLTest_RunSuites().

#define TEST_RESULT_SETUP_FAILURE   4

Definition at line 61 of file SDL_test_harness.h.

Referenced by SDLTest_RunTest().

#define TEST_RESULT_SKIPPED   3

Definition at line 60 of file SDL_test_harness.h.

Referenced by SDLTest_RunSuites(), and SDLTest_RunTest().

#define TEST_SKIPPED   2

Definition at line 54 of file SDL_test_harness.h.

Referenced by SDLTest_RunTest().

#define TEST_STARTED   0

Definition at line 52 of file SDL_test_harness.h.

Referenced by SDLTest_RunTest().

Typedef Documentation

typedef int(* SDLTest_TestCaseFp)(void *arg)

Definition at line 67 of file SDL_test_harness.h.

Holds information about a single test case.

typedef void(* SDLTest_TestCaseSetUpFp)(void *arg)

Definition at line 64 of file SDL_test_harness.h.

typedef void(* SDLTest_TestCaseTearDownFp)(void *arg)

Definition at line 70 of file SDL_test_harness.h.

Holds information about a test suite (multiple test cases).

Function Documentation

int SDLTest_RunSuites ( SDLTest_TestSuiteReference testSuites[],
const char *  userRunSeed,
Uint64  userExecKey,
const char *  filter,
int  testIterations 
)

Execute a test suite using the given run seed and execution key.

Parameters
testSuitesSuites containing the test case.
userRunSeedCustom run seed provided by user, or NULL to autogenerate one.
userExecKeyCustom execution key provided by user, or 0 to autogenerate one.
filterFilter specification. NULL disables. Case sensitive.
testIterationsNumber of iterations to run each test case.
Returns
Test run result; 0 when all tests passed, 1 if any tests failed.

Execute a test suite using the given run seed and execution key.

The filter string is matched to the suite name (full comparison) to select a single suite, or if no suite matches, it is matched to the test names (full comparison) to select a single test.

Parameters
testSuitesSuites containing the test case.
userRunSeedCustom run seed provided by user, or NULL to autogenerate one.
userExecKeyCustom execution key provided by user, or 0 to autogenerate one.
filterFilter specification. NULL disables. Case sensitive.
testIterationsNumber of iterations to run each test case.
Returns
Test run result; 0 when all tests passed, 1 if any tests failed.

Definition at line 363 of file SDL_test_harness.c.

References SDLTest_TestCaseReference::description, SDLTest_TestCaseReference::enabled, GetClock(), if(), SDLTest_TestCaseReference::name, SDLTest_TestSuiteReference::name, NULL, SDL_strcmp(), SDLTest_FinalResultFormat, SDLTest_GenerateExecKey(), SDLTest_GenerateRunSeed(), SDLTest_InvalidNameFormat, SDLTest_Log(), SDLTest_LogError(), SDLTest_LogSummaryFormat, SDLTest_RunTest(), TEST_RESULT_FAILED, TEST_RESULT_NO_ASSERT, TEST_RESULT_PASSED, TEST_RESULT_SKIPPED, and SDLTest_TestSuiteReference::testCases.