mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 09:48:26 +00:00
Remove more reserved identifiers (#6925)
This commit is contained in:
parent
ce412c2c71
commit
d7d3c22dbf
29 changed files with 517 additions and 517 deletions
|
@ -5,17 +5,17 @@
|
|||
#include <SDL3/SDL_test.h>
|
||||
|
||||
/* Flag indicating if the param should be checked */
|
||||
int _paramCheck = 0;
|
||||
static int g_paramCheck = 0;
|
||||
|
||||
/* Userdata value to check */
|
||||
int _paramValue = 0;
|
||||
static int g_paramValue = 0;
|
||||
|
||||
/* Flag indicating that the callback was called */
|
||||
int _timerCallbackCalled = 0;
|
||||
static int g_timerCallbackCalled = 0;
|
||||
|
||||
/* Fixture */
|
||||
|
||||
void _timerSetUp(void *arg)
|
||||
static void timerSetUp(void *arg)
|
||||
{
|
||||
/* Start SDL timer subsystem */
|
||||
int ret = SDL_InitSubSystem(SDL_INIT_TIMER);
|
||||
|
@ -97,14 +97,14 @@ int timer_delayAndGetTicks(void *arg)
|
|||
}
|
||||
|
||||
/* Test callback */
|
||||
Uint32 SDLCALL _timerTestCallback(Uint32 interval, void *param)
|
||||
static Uint32 SDLCALL timerTestCallback(Uint32 interval, void *param)
|
||||
{
|
||||
_timerCallbackCalled = 1;
|
||||
g_timerCallbackCalled = 1;
|
||||
|
||||
if (_paramCheck != 0) {
|
||||
if (g_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);
|
||||
SDLTest_AssertCheck(*(int *)param == g_paramValue, "Check param value, expected: %i, got: %i", g_paramValue, *(int *)param);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,11 +121,11 @@ int timer_addRemoveTimer(void *arg)
|
|||
int param;
|
||||
|
||||
/* Reset state */
|
||||
_paramCheck = 0;
|
||||
_timerCallbackCalled = 0;
|
||||
g_paramCheck = 0;
|
||||
g_timerCallbackCalled = 0;
|
||||
|
||||
/* Set timer with a long delay */
|
||||
id = SDL_AddTimer(10000, _timerTestCallback, NULL);
|
||||
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);
|
||||
|
||||
|
@ -133,7 +133,7 @@ int timer_addRemoveTimer(void *arg)
|
|||
result = SDL_RemoveTimer(id);
|
||||
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Check result value, expected: %i, got: %i", SDL_TRUE, result);
|
||||
SDLTest_AssertCheck(_timerCallbackCalled == 0, "Check callback WAS NOT called, expected: 0, got: %i", _timerCallbackCalled);
|
||||
SDLTest_AssertCheck(g_timerCallbackCalled == 0, "Check callback WAS NOT called, expected: 0, got: %i", g_timerCallbackCalled);
|
||||
|
||||
/* Try to remove timer again (should be a NOOP) */
|
||||
result = SDL_RemoveTimer(id);
|
||||
|
@ -142,12 +142,12 @@ int timer_addRemoveTimer(void *arg)
|
|||
|
||||
/* Reset state */
|
||||
param = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
_paramCheck = 1;
|
||||
_paramValue = param;
|
||||
_timerCallbackCalled = 0;
|
||||
g_paramCheck = 1;
|
||||
g_paramValue = param;
|
||||
g_timerCallbackCalled = 0;
|
||||
|
||||
/* Set timer with a short delay */
|
||||
id = SDL_AddTimer(10, _timerTestCallback, (void *)¶m);
|
||||
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);
|
||||
|
||||
|
@ -159,7 +159,7 @@ int timer_addRemoveTimer(void *arg)
|
|||
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);
|
||||
SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ static const SDLTest_TestCaseReference *timerTests[] = {
|
|||
/* Timer test suite (global) */
|
||||
SDLTest_TestSuiteReference timerTestSuite = {
|
||||
"Timer",
|
||||
_timerSetUp,
|
||||
timerSetUp,
|
||||
timerTests,
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue