File style cleanup for the SDL 2.0 release
This commit is contained in:
parent
2ac8624930
commit
0cb6385637
376 changed files with 17562 additions and 17773 deletions
|
@ -21,11 +21,11 @@ int _timerCallbackCalled = 0;
|
|||
void
|
||||
_timerSetUp(void *arg)
|
||||
{
|
||||
/* Start SDL timer subsystem */
|
||||
int ret = SDL_InitSubSystem( SDL_INIT_TIMER );
|
||||
/* Start SDL timer subsystem */
|
||||
int ret = SDL_InitSubSystem( SDL_INIT_TIMER );
|
||||
SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_TIMER)");
|
||||
SDLTest_AssertCheck(ret==0, "Check result from SDL_InitSubSystem(SDL_INIT_TIMER)");
|
||||
if (ret != 0) {
|
||||
SDLTest_AssertCheck(ret==0, "Check result from SDL_InitSubSystem(SDL_INIT_TIMER)");
|
||||
if (ret != 0) {
|
||||
SDLTest_LogError("%s", SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ int
|
|||
timer_getPerformanceCounter(void *arg)
|
||||
{
|
||||
Uint64 result;
|
||||
|
||||
|
||||
result = SDL_GetPerformanceCounter();
|
||||
SDLTest_AssertPass("Call to SDL_GetPerformanceCounter()");
|
||||
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %lu", result);
|
||||
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
@ -54,11 +54,11 @@ int
|
|||
timer_getPerformanceFrequency(void *arg)
|
||||
{
|
||||
Uint64 result;
|
||||
|
||||
|
||||
result = SDL_GetPerformanceFrequency();
|
||||
SDLTest_AssertPass("Call to SDL_GetPerformanceFrequency()");
|
||||
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %lu", result);
|
||||
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
@ -74,18 +74,18 @@ timer_delayAndGetTicks(void *arg)
|
|||
Uint32 result2;
|
||||
Uint32 difference;
|
||||
|
||||
/* Zero delay */
|
||||
/* Zero delay */
|
||||
SDL_Delay(0);
|
||||
SDLTest_AssertPass("Call to SDL_Delay(0)");
|
||||
|
||||
|
||||
/* Non-zero delay */
|
||||
SDL_Delay(1);
|
||||
SDLTest_AssertPass("Call to SDL_Delay(1)");
|
||||
|
||||
SDL_Delay(SDLTest_RandomIntegerInRange(5, 15));
|
||||
SDLTest_AssertPass("Call to SDL_Delay()");
|
||||
|
||||
/* Get ticks count - should be non-zero by now */
|
||||
|
||||
/* Get ticks count - should be non-zero by now */
|
||||
result = SDL_GetTicks();
|
||||
SDLTest_AssertPass("Call to SDL_GetTicks()");
|
||||
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %d", result);
|
||||
|
@ -99,7 +99,7 @@ timer_delayAndGetTicks(void *arg)
|
|||
difference = result2 - result;
|
||||
SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %d", testDelay - marginOfError, difference);
|
||||
SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %d", testDelay + marginOfError, difference);
|
||||
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
@ -107,14 +107,14 @@ timer_delayAndGetTicks(void *arg)
|
|||
Uint32 _timerTestCallback(Uint32 interval, void *param)
|
||||
{
|
||||
_timerCallbackCalled = 1;
|
||||
|
||||
|
||||
if (_paramCheck != 0) {
|
||||
SDLTest_AssertCheck(param != NULL, "Check param pointer, expected: non-NULL, got: %s", (param != NULL) ? "non-NULL" : "NULL");
|
||||
if (param != NULL) {
|
||||
SDLTest_AssertCheck(*(int *)param == _paramValue, "Check param value, expected: %i, got: %i", _paramValue, *(int *)param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -131,12 +131,12 @@ timer_addRemoveTimer(void *arg)
|
|||
/* Reset state */
|
||||
_paramCheck = 0;
|
||||
_timerCallbackCalled = 0;
|
||||
|
||||
/* Set timer with a long delay */
|
||||
|
||||
/* Set timer with a long delay */
|
||||
id = SDL_AddTimer(10000, _timerTestCallback, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_AddTimer(10000,...)");
|
||||
SDLTest_AssertCheck(id > 0, "Check result value, expected: >0, got: %d", id);
|
||||
|
||||
|
||||
/* Remove timer again and check that callback was not called */
|
||||
result = SDL_RemoveTimer(id);
|
||||
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
||||
|
@ -154,21 +154,21 @@ timer_addRemoveTimer(void *arg)
|
|||
_paramValue = param;
|
||||
_timerCallbackCalled = 0;
|
||||
|
||||
/* Set timer with a short delay */
|
||||
/* Set timer with a short delay */
|
||||
id = SDL_AddTimer(10, _timerTestCallback, (void *)¶m);
|
||||
SDLTest_AssertPass("Call to SDL_AddTimer(10, param)");
|
||||
SDLTest_AssertCheck(id > 0, "Check result value, expected: >0, got: %d", id);
|
||||
|
||||
|
||||
/* Wait to let timer trigger callback */
|
||||
SDL_Delay(100);
|
||||
SDLTest_AssertPass("Call to SDL_Delay(100)");
|
||||
|
||||
|
||||
/* Remove timer again and check that callback was called */
|
||||
result = SDL_RemoveTimer(id);
|
||||
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
||||
SDLTest_AssertCheck(result == SDL_FALSE, "Check result value, expected: %i, got: %i", SDL_FALSE, result);
|
||||
SDLTest_AssertCheck(_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", _timerCallbackCalled);
|
||||
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
@ -176,26 +176,26 @@ timer_addRemoveTimer(void *arg)
|
|||
|
||||
/* Timer test cases */
|
||||
static const SDLTest_TestCaseReference timerTest1 =
|
||||
{ (SDLTest_TestCaseFp)timer_getPerformanceCounter, "timer_getPerformanceCounter", "Call to SDL_GetPerformanceCounter", TEST_ENABLED };
|
||||
{ (SDLTest_TestCaseFp)timer_getPerformanceCounter, "timer_getPerformanceCounter", "Call to SDL_GetPerformanceCounter", TEST_ENABLED };
|
||||
|
||||
static const SDLTest_TestCaseReference timerTest2 =
|
||||
{ (SDLTest_TestCaseFp)timer_getPerformanceFrequency, "timer_getPerformanceFrequency", "Call to SDL_GetPerformanceFrequency", TEST_ENABLED };
|
||||
{ (SDLTest_TestCaseFp)timer_getPerformanceFrequency, "timer_getPerformanceFrequency", "Call to SDL_GetPerformanceFrequency", TEST_ENABLED };
|
||||
|
||||
static const SDLTest_TestCaseReference timerTest3 =
|
||||
{ (SDLTest_TestCaseFp)timer_delayAndGetTicks, "timer_delayAndGetTicks", "Call to SDL_Delay and SDL_GetTicks", TEST_ENABLED };
|
||||
{ (SDLTest_TestCaseFp)timer_delayAndGetTicks, "timer_delayAndGetTicks", "Call to SDL_Delay and SDL_GetTicks", TEST_ENABLED };
|
||||
|
||||
static const SDLTest_TestCaseReference timerTest4 =
|
||||
{ (SDLTest_TestCaseFp)timer_addRemoveTimer, "timer_addRemoveTimer", "Call to SDL_AddTimer and SDL_RemoveTimer", TEST_ENABLED };
|
||||
{ (SDLTest_TestCaseFp)timer_addRemoveTimer, "timer_addRemoveTimer", "Call to SDL_AddTimer and SDL_RemoveTimer", TEST_ENABLED };
|
||||
|
||||
/* Sequence of Timer test cases */
|
||||
static const SDLTest_TestCaseReference *timerTests[] = {
|
||||
&timerTest1, &timerTest2, &timerTest3, &timerTest4, NULL
|
||||
&timerTest1, &timerTest2, &timerTest3, &timerTest4, NULL
|
||||
};
|
||||
|
||||
/* Timer test suite (global) */
|
||||
SDLTest_TestSuiteReference timerTestSuite = {
|
||||
"Timer",
|
||||
_timerSetUp,
|
||||
timerTests,
|
||||
NULL
|
||||
"Timer",
|
||||
_timerSetUp,
|
||||
timerTests,
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue