本文整理汇总了C++中SDLTest_AssertCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ SDLTest_AssertCheck函数的具体用法?C++ SDLTest_AssertCheck怎么用?C++ SDLTest_AssertCheck使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDLTest_AssertCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rwops_testParamNegative
/*!
* Negative test for SDL_RWFromFile parameters
*
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
*
*/
int
rwops_testParamNegative (void)
{
SDL_RWops *rwops;
/* These should all fail. */
rwops = SDL_RWFromFile(NULL, NULL);
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, NULL) succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, NULL) returns NULL");
rwops = SDL_RWFromFile(NULL, "ab+");
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"ab+\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"ab+\") returns NULL");
rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"sldfkjsldkfj\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"sldfkjsldkfj\") returns NULL");
rwops = SDL_RWFromFile("something", "");
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", \"\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", \"\") returns NULL");
rwops = SDL_RWFromFile("something", NULL);
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", NULL) succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", NULL) returns NULL");
return TEST_COMPLETED;
}
示例2: audio_printAudioDrivers
/**
* \brief Checks available audio driver names.
*
* \sa https://wiki.libsdl.org/SDL_GetNumAudioDrivers
* \sa https://wiki.libsdl.org/SDL_GetAudioDriver
*/
int audio_printAudioDrivers()
{
int i, n;
const char *name;
/* Get number of drivers */
n = SDL_GetNumAudioDrivers();
SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()");
SDLTest_AssertCheck(n>=0, "Verify number of audio drivers >= 0, got: %i", n);
/* List drivers. */
if (n>0)
{
for (i=0; i<n; i++) {
name = SDL_GetAudioDriver(i);
SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
if (name != NULL) {
SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
}
}
}
return TEST_COMPLETED;
}
示例3: render_testBlitColor
/**
* @brief Blits doing color tests.
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
* http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
* http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
*/
int
render_testBlitColor (void *arg)
{
int ret;
SDL_Rect rect;
SDL_Texture *tface;
SDL_Surface *referenceSurface = NULL;
Uint32 tformat;
int taccess, tw, th;
int i, j, ni, nj;
int checkFailCount1;
int checkFailCount2;
/* Create face surface. */
tface = _loadTestFace();
SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
if (tface == NULL) {
return TEST_ABORTED;
}
/* Constant values. */
ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
rect.w = tw;
rect.h = th;
ni = TESTRENDER_SCREEN_W - tw;
nj = TESTRENDER_SCREEN_H - th;
/* Test blitting with color mod. */
checkFailCount1 = 0;
checkFailCount2 = 0;
for (j=0; j <= nj; j+=4) {
for (i=0; i <= ni; i+=4) {
/* Set color mod. */
ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
if (ret != 0) checkFailCount1++;
/* Blitting. */
rect.x = i;
rect.y = j;
ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
if (ret != 0) checkFailCount2++;
}
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
/* See if it's the same. */
referenceSurface = SDLTest_ImageBlitColor();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
return TEST_COMPLETED;
}
示例4: audio_buildAudioCVT
/**
* \brief Builds various audio conversion structures
*
* \sa https://wiki.libsdl.org/SDL_BuildAudioCVT
*/
int audio_buildAudioCVT()
{
int result;
SDL_AudioCVT cvt;
SDL_AudioSpec spec1;
SDL_AudioSpec spec2;
int i, ii, j, jj, k, kk;
/* No conversion needed */
spec1.format = AUDIO_S16LSB;
spec1.channels = 2;
spec1.freq = 22050;
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
spec1.format, spec1.channels, spec1.freq);
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(spec1 ==> spec1)");
SDLTest_AssertCheck(result == 0, "Verify result value; expected: 0, got: %i", result);
/* Typical conversion */
spec1.format = AUDIO_S8;
spec1.channels = 1;
spec1.freq = 22050;
spec2.format = AUDIO_S16LSB;
spec2.channels = 2;
spec2.freq = 44100;
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
spec2.format, spec2.channels, spec2.freq);
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(spec1 ==> spec2)");
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
/* All source conversions with random conversion targets, allow 'null' conversions */
for (i = 0; i < _numAudioFormats; i++) {
for (j = 0; j < _numAudioChannels; j++) {
for (k = 0; k < _numAudioFrequencies; k++) {
spec1.format = _audioFormats[i];
spec1.channels = _audioChannels[j];
spec1.freq = _audioFrequencies[k];
ii = SDLTest_RandomIntegerInRange(0, _numAudioFormats - 1);
jj = SDLTest_RandomIntegerInRange(0, _numAudioChannels - 1);
kk = SDLTest_RandomIntegerInRange(0, _numAudioFrequencies - 1);
spec2.format = _audioFormats[ii];
spec2.channels = _audioChannels[jj];
spec2.freq = _audioFrequencies[kk];
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
spec2.format, spec2.channels, spec2.freq);
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
i, _audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
SDLTest_AssertCheck(result == 0 || result == 1, "Verify result value; expected: 0 or 1, got: %i", result);
if (result<0) {
SDLTest_LogError("%s", SDL_GetError());
} else {
SDLTest_AssertCheck(cvt.len_mult > 0, "Verify that cvt.len_mult value; expected: >0, got: %i", cvt.len_mult);
}
}
}
}
return TEST_COMPLETED;
}
示例5: audio_lockUnlockOpenAudioDevice
/**
* \brief Locks and unlocks open audio device.
*
* \sa https://wiki.libsdl.org/SDL_LockAudioDevice
* \sa https://wiki.libsdl.org/SDL_UnlockAudioDevice
*/
int audio_lockUnlockOpenAudioDevice()
{
int i;
int count;
char *device;
SDL_AudioDeviceID id;
SDL_AudioSpec desired, obtained;
/* Get number of devices. */
count = SDL_GetNumAudioDevices(0);
SDLTest_AssertPass("Call to SDL_GetNumAudioDevices(0)");
if (count > 0) {
for (i = 0; i < count; i++) {
/* Get device name */
device = (char *)SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
if (device == NULL) return TEST_ABORTED;
/* Set standard desired spec */
desired.freq=22050;
desired.format=AUDIO_S16SYS;
desired.channels=2;
desired.samples=4096;
desired.callback=_audio_testCallback;
desired.userdata=NULL;
/* Open device */
id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id);
if (id > 1) {
/* Lock to protect callback */
SDL_LockAudioDevice(id);
SDLTest_AssertPass("SDL_LockAudioDevice(%i)", id);
/* Simulate callback processing */
SDL_Delay(10);
SDLTest_Log("Simulate callback processing - delay");
/* Unlock again */
SDL_UnlockAudioDevice(id);
SDLTest_AssertPass("SDL_UnlockAudioDevice(%i)", id);
/* Close device again */
SDL_CloseAudioDevice(id);
SDLTest_AssertPass("Call to SDL_CloseAudioDevice()");
}
}
} else {
SDLTest_Log("No devices to test with");
}
return TEST_COMPLETED;
}
示例6: audio_openCloseAudioDeviceConnected
/**
* \brief Opens, checks current connected status, and closes a device.
*
* \sa https://wiki.libsdl.org/SDL_AudioDeviceConnected
*/
int audio_openCloseAudioDeviceConnected()
{
int result = -1;
int i;
int count;
char *device;
SDL_AudioDeviceID id;
SDL_AudioSpec desired, obtained;
/* Get number of devices. */
count = SDL_GetNumAudioDevices(0);
SDLTest_AssertPass("Call to SDL_GetNumAudioDevices(0)");
if (count > 0) {
for (i = 0; i < count; i++) {
/* Get device name */
device = (char *)SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
if (device == NULL) return TEST_ABORTED;
/* Set standard desired spec */
desired.freq=22050;
desired.format=AUDIO_S16SYS;
desired.channels=2;
desired.samples=4096;
desired.callback=_audio_testCallback;
desired.userdata=NULL;
/* Open device */
id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %i", id);
if (id > 1) {
/* TODO: enable test code when function is available in SDL2 */
#ifdef AUDIODEVICECONNECTED_DEFINED
/* Get connected status */
result = SDL_AudioDeviceConnected(id);
SDLTest_AssertPass("Call to SDL_AudioDeviceConnected()");
#endif
SDLTest_AssertCheck(result == 1, "Verify returned value; expected: 1; got: %i", result);
/* Close device again */
SDL_CloseAudioDevice(id);
SDLTest_AssertPass("Call to SDL_CloseAudioDevice()");
}
}
} else {
SDLTest_Log("No devices to test with");
}
return TEST_COMPLETED;
}
示例7: mouse_getMouseFocus
/**
* @brief Check call to SDL_GetMouseFocus
*
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetMouseFocus
*/
int
mouse_getMouseFocus(void *arg)
{
const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
int x, y;
SDL_Window *window;
SDL_Window *focusWindow;
/* Get focus - focus non-deterministic */
focusWindow = SDL_GetMouseFocus();
SDLTest_AssertPass("SDL_GetMouseFocus()");
/* Create test window */
window = _createMouseSuiteTestWindow();
if (window == NULL) return TEST_ABORTED;
/* Mouse to random position inside window */
x = SDLTest_RandomIntegerInRange(1, w-1);
y = SDLTest_RandomIntegerInRange(1, h-1);
SDL_WarpMouseInWindow(window, x, y);
SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
/* Pump events to update focus state */
SDL_PumpEvents();
SDLTest_AssertPass("SDL_PumpEvents()");
/* Get focus with explicit window setup - focus deterministic */
focusWindow = SDL_GetMouseFocus();
SDLTest_AssertPass("SDL_GetMouseFocus()");
SDLTest_AssertCheck (focusWindow != NULL, "Check returned window value is not NULL");
SDLTest_AssertCheck (focusWindow == window, "Check returned window value is test window");
/* Mouse to random position outside window */
x = SDLTest_RandomIntegerInRange(-9, -1);
y = SDLTest_RandomIntegerInRange(-9, -1);
SDL_WarpMouseInWindow(window, x, y);
SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
/* Clean up test window */
_destroyMouseSuiteTestWindow(window);
/* Pump events to update focus state */
SDL_PumpEvents();
SDLTest_AssertPass("SDL_PumpEvents()");
/* Get focus for non-existing window */
focusWindow = SDL_GetMouseFocus();
SDLTest_AssertPass("SDL_GetMouseFocus()");
SDLTest_AssertCheck (focusWindow == NULL, "Check returned window value is NULL");
return TEST_COMPLETED;
}
示例8: audio_printCurrentAudioDriver
/**
* \brief Checks current audio driver name with initialized audio.
*
* \sa https://wiki.libsdl.org/SDL_GetCurrentAudioDriver
*/
int audio_printCurrentAudioDriver()
{
/* Check current audio driver */
const char *name = SDL_GetCurrentAudioDriver();
SDLTest_AssertPass("Call to SDL_GetCurrentAudioDriver()");
SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
if (name != NULL) {
SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
}
return TEST_COMPLETED;
}
示例9: keyboard_getSetModState
/**
* @brief Check call to SDL_GetModState and SDL_SetModState
*
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetModState
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetModState
*/
int
keyboard_getSetModState(void *arg)
{
SDL_Keymod result;
SDL_Keymod currentState;
SDL_Keymod newState;
SDL_Keymod allStates =
KMOD_NONE |
KMOD_LSHIFT |
KMOD_RSHIFT |
KMOD_LCTRL |
KMOD_RCTRL |
KMOD_LALT |
KMOD_RALT |
KMOD_LGUI |
KMOD_RGUI |
KMOD_NUM |
KMOD_CAPS |
KMOD_MODE |
KMOD_RESERVED;
/* Get state, cache for later reset */
result = SDL_GetModState();
SDLTest_AssertPass("Call to SDL_GetModState()");
SDLTest_AssertCheck(result >=0 && result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result);
currentState = result;
/* Set random state */
newState = SDLTest_RandomIntegerInRange(0, allStates);
SDL_SetModState(newState);
SDLTest_AssertPass("Call to SDL_SetModState(%i)", newState);
result = SDL_GetModState();
SDLTest_AssertPass("Call to SDL_GetModState()");
SDLTest_AssertCheck(result == newState, "Verify result from call is valid, expected: %i, got: %i", newState, result);
/* Set zero state */
SDL_SetModState(0);
SDLTest_AssertPass("Call to SDL_SetModState(0)");
result = SDL_GetModState();
SDLTest_AssertPass("Call to SDL_GetModState()");
SDLTest_AssertCheck(result == 0, "Verify result from call is valid, expected: 0, got: %i", result);
/* Revert back to cached current state if needed */
if (currentState != 0) {
SDL_SetModState(currentState);
SDLTest_AssertPass("Call to SDL_SetModState(%i)", currentState);
result = SDL_GetModState();
SDLTest_AssertPass("Call to SDL_GetModState()");
SDLTest_AssertCheck(result == currentState, "Verify result from call is valid, expected: %i, got: %i", currentState, result);
}
return TEST_COMPLETED;
}
示例10: audio_openCloseAndGetAudioStatus
/**
* \brief Opens, checks current audio status, and closes a device.
*
* \sa https://wiki.libsdl.org/SDL_GetAudioStatus
*/
int audio_openCloseAndGetAudioStatus()
{
SDL_AudioStatus result;
int i;
int count;
char *device;
SDL_AudioDeviceID id;
SDL_AudioSpec desired, obtained;
/* Get number of devices. */
count = SDL_GetNumAudioDevices(0);
SDLTest_AssertPass("Call to SDL_GetNumAudioDevices(0)");
if (count > 0) {
for (i = 0; i < count; i++) {
/* Get device name */
device = (char *)SDL_GetAudioDeviceName(i, 0);
SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
if (device == NULL) return TEST_ABORTED;
/* Set standard desired spec */
desired.freq=22050;
desired.format=AUDIO_S16SYS;
desired.channels=2;
desired.samples=4096;
desired.callback=_audio_testCallback;
desired.userdata=NULL;
/* Open device */
id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id);
if (id > 1) {
/* Check device audio status */
result = SDL_GetAudioDeviceStatus(id);
SDLTest_AssertPass("Call to SDL_GetAudioDeviceStatus()");
SDLTest_AssertCheck(result == SDL_AUDIO_STOPPED || result == SDL_AUDIO_PLAYING || result == SDL_AUDIO_PAUSED,
"Verify returned value; expected: STOPPED (%i) | PLAYING (%i) | PAUSED (%i), got: %i",
SDL_AUDIO_STOPPED, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED, result);
/* Close device again */
SDL_CloseAudioDevice(id);
SDLTest_AssertPass("Call to SDL_CloseAudioDevice()");
}
}
} else {
SDLTest_Log("No devices to test with");
}
return TEST_COMPLETED;
}
示例11: _timerTestCallback
/* Test callback */
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;
}
示例12: _events_sampleNullEventFilter
/* Event filter that sets some flags and optionally checks userdata */
int _events_sampleNullEventFilter(void *userdata, SDL_Event *event)
{
_eventFilterCalled = 1;
if (_userdataCheck != 0) {
SDLTest_AssertCheck(userdata != NULL, "Check userdata pointer, expected: non-NULL, got: %s", (userdata != NULL) ? "non-NULL" : "NULL");
if (userdata != NULL) {
SDLTest_AssertCheck(*(int *)userdata == _userdataValue, "Check userdata value, expected: %i, got: %i", _userdataValue, *(int *)userdata);
}
}
return 0;
}
示例13: RWopsTearDown
void
RWopsTearDown(void *arg)
{
int result;
/* Remove the created files to clean up; ignore errors for write filename */
result = remove(RWopsReadTestFilename);
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", RWopsReadTestFilename, result);
remove(RWopsWriteTestFilename);
result = remove(RWopsAlphabetFilename);
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", RWopsAlphabetFilename, result);
SDLTest_AssertPass("Cleanup of test files completed");
}
示例14: rwops_testCompareRWFromMemWithRWFromFile
/**
* @brief Compare memory and file reads
*
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
*/
int
rwops_testCompareRWFromMemWithRWFromFile(void)
{
int slen = 26;
char buffer_file[27];
char buffer_mem[27];
size_t rv_file;
size_t rv_mem;
Uint64 sv_file;
Uint64 sv_mem;
SDL_RWops* rwops_file;
SDL_RWops* rwops_mem;
int size;
int result;
for (size=5; size<10; size++)
{
/* Terminate buffer */
buffer_file[slen] = 0;
buffer_mem[slen] = 0;
/* Read/seek from memory */
rwops_mem = SDL_RWFromMem((void *)RWopsAlphabetString, slen);
SDLTest_AssertPass("Call to SDL_RWFromMem()");
rv_mem = SDL_RWread(rwops_mem, buffer_mem, size, 6);
SDLTest_AssertPass("Call to SDL_RWread(mem, size=%d)", size);
sv_mem = SDL_RWseek(rwops_mem, 0, SEEK_END);
SDLTest_AssertPass("Call to SDL_RWseek(mem,SEEK_END)");
result = SDL_RWclose(rwops_mem);
SDLTest_AssertPass("Call to SDL_RWclose(mem)");
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
/* Read/see from file */
rwops_file = SDL_RWFromFile(RWopsAlphabetFilename, "r");
SDLTest_AssertPass("Call to SDL_RWFromFile()");
rv_file = SDL_RWread(rwops_file, buffer_file, size, 6);
SDLTest_AssertPass("Call to SDL_RWread(file, size=%d)", size);
sv_file = SDL_RWseek(rwops_file, 0, SEEK_END);
SDLTest_AssertPass("Call to SDL_RWseek(file,SEEK_END)");
result = SDL_RWclose(rwops_file);
SDLTest_AssertPass("Call to SDL_RWclose(file)");
SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);
/* Compare */
SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", rv_mem, rv_file);
SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%llu sv_file=%llu", sv_mem, sv_file);
SDLTest_AssertCheck(buffer_mem[slen] == 0, "Verify mem buffer termination; expected: 0, got: %d", buffer_mem[slen]);
SDLTest_AssertCheck(buffer_file[slen] == 0, "Verify file buffer termination; expected: 0, got: %d", buffer_file[slen]);
SDLTest_AssertCheck(
SDL_strncmp(buffer_mem, RWopsAlphabetString, slen) == 0,
"Verify mem buffer contain alphabet string; expected: %s, got: %s", RWopsAlphabetString, buffer_mem);
SDLTest_AssertCheck(
SDL_strncmp(buffer_file, RWopsAlphabetString, slen) == 0,
"Verify file buffer contain alphabet string; expected: %s, got: %s", RWopsAlphabetString, buffer_file);
}
return TEST_COMPLETED;
}
示例15: _checkInvalidNameError
/*
* Local helper to check for the invalid scancode error message
*/
void
_checkInvalidNameError()
{
const char *expectedError = "Parameter 'name' is invalid";
const char *error;
error = SDL_GetError();
SDLTest_AssertPass("Call to SDL_GetError()");
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
if (error != NULL) {
SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
"Validate error message, expected: '%s', got: '%s'", expectedError, error);
SDL_ClearError();
SDLTest_AssertPass("Call to SDL_ClearError()");
}
}