Refactoring the code (runner.c).
Adding support for executing tests in-proc.
This commit is contained in:
parent
73fa28c71c
commit
bc147958d8
4 changed files with 96 additions and 65 deletions
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include "SDL_test.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! \brief return value of test case. Non-zero value means that the test failed */
|
||||
static int _testReturnValue;
|
||||
|
||||
|
@ -34,10 +32,10 @@ TestCaseInit()
|
|||
_testReturnValue = 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
TestCaseQuit()
|
||||
{
|
||||
exit(_testReturnValue);
|
||||
return _testReturnValue;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -48,8 +48,9 @@ void TestCaseInit();
|
|||
/*! \fn TestCaseQuit
|
||||
* Deinitializes and exits the test case
|
||||
*
|
||||
* \return 0 if test succeeded, otherwise 1
|
||||
*/
|
||||
void TestCaseQuit();
|
||||
int TestCaseQuit();
|
||||
|
||||
|
||||
void AssertEquals(char *message, Uint32 expected, Uint32 actual);
|
||||
|
|
|
@ -32,7 +32,7 @@ static const TestCaseReference test1 =
|
|||
(TestCaseReference){ "hello", "description", TEST_ENABLED, 0 };
|
||||
|
||||
static const TestCaseReference test2 =
|
||||
(TestCaseReference){ "hello2", "description", TEST_DISABLED, 0 };
|
||||
(TestCaseReference){ "hello2", "description", TEST_ENABLED, 0 };
|
||||
|
||||
static const TestCaseReference test3 =
|
||||
(TestCaseReference){ "hello3", "description", TEST_ENABLED, 0 };
|
||||
|
@ -48,7 +48,7 @@ TestCaseReference **QueryTestSuite() {
|
|||
}
|
||||
|
||||
/* Test case functions */
|
||||
void hello(void *arg)
|
||||
int hello(void *arg)
|
||||
{
|
||||
TestCaseInit();
|
||||
|
||||
|
@ -57,27 +57,27 @@ void hello(void *arg)
|
|||
printf("Revision is %s\n", revision);
|
||||
AssertEquals("will fail", 3, 5);
|
||||
|
||||
TestCaseQuit();
|
||||
return TestCaseQuit();
|
||||
}
|
||||
|
||||
void hello2(void *arg)
|
||||
int hello2(void *arg)
|
||||
{
|
||||
TestCaseInit();
|
||||
|
||||
char *msg = "eello";
|
||||
msg[0] = 'H';
|
||||
//msg[0] = 'H';
|
||||
|
||||
TestCaseQuit();
|
||||
return TestCaseQuit();
|
||||
}
|
||||
|
||||
void hello3(void *arg)
|
||||
int hello3(void *arg)
|
||||
{
|
||||
TestCaseInit();
|
||||
printf("hello3\n");
|
||||
|
||||
AssertEquals("passes", 3, 3);
|
||||
|
||||
TestCaseQuit();
|
||||
return TestCaseQuit();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue