forked from Green-Sky/tomato
Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
51
external/sdl/SDL/test/testautomation_rwops.c
vendored
51
external/sdl/SDL/test/testautomation_rwops.c
vendored
@ -90,7 +90,7 @@ static void RWopsTearDown(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Makes sure parameters work properly. Local helper function.
|
||||
* Makes sure parameters work properly. Local helper function.
|
||||
*
|
||||
* \sa SDL_RWseek
|
||||
* \sa SDL_RWread
|
||||
@ -110,11 +110,11 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test write. */
|
||||
/* Test write */
|
||||
s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
|
||||
if (write) {
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int)s);
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_RWwrite, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int)s);
|
||||
}
|
||||
@ -129,6 +129,37 @@ static void testGenericRWopsValidations(SDL_RWops *rw, SDL_bool write)
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWread succeeded");
|
||||
SDLTest_AssertCheck(
|
||||
s == (sizeof(RWopsHelloWorldTestString) - 1),
|
||||
"Verify result from SDL_RWread, expected %i, got %i",
|
||||
(int)(sizeof(RWopsHelloWorldTestString) - 1),
|
||||
(int)s);
|
||||
SDLTest_AssertCheck(
|
||||
SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString) - 1) == 0,
|
||||
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test printf */
|
||||
s = SDL_RWprintf(rw, "%s", RWopsHelloWorldTestString);
|
||||
SDLTest_AssertPass("Call to SDL_RWprintf succeeded");
|
||||
if (write) {
|
||||
SDLTest_AssertCheck(s == sizeof(RWopsHelloWorldTestString) - 1, "Verify result of writing with SDL_RWprintf, expected %i, got %i", (int)sizeof(RWopsHelloWorldTestString) - 1, (int)s);
|
||||
} else {
|
||||
SDLTest_AssertCheck(s == 0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int)s);
|
||||
}
|
||||
|
||||
/* Test seek back to start */
|
||||
i = SDL_RWseek(rw, 0, SDL_RW_SEEK_SET);
|
||||
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
|
||||
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (SDL_RW_SEEK_SET), expected 0, got %" SDL_PRIs64, i);
|
||||
|
||||
/* Test read */
|
||||
s = SDL_RWread(rw, buf, sizeof(RWopsHelloWorldTestString) - 1);
|
||||
SDLTest_AssertPass("Call to SDL_RWread succeeded");
|
||||
@ -214,7 +245,7 @@ static int rwops_testParamNegative(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests opening from memory.
|
||||
* Tests opening from memory.
|
||||
*
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_RWClose
|
||||
@ -253,7 +284,7 @@ static int rwops_testMem(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests opening from memory.
|
||||
* Tests opening from memory.
|
||||
*
|
||||
* \sa SDL_RWFromConstMem
|
||||
* \sa SDL_RWClose
|
||||
@ -288,7 +319,7 @@ static int rwops_testConstMem(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests reading from file.
|
||||
* Tests reading from file.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
@ -335,7 +366,7 @@ static int rwops_testFileRead(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests writing from file.
|
||||
* Tests writing from file.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
@ -382,7 +413,7 @@ static int rwops_testFileWrite(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests alloc and free RW context.
|
||||
* Tests alloc and free RW context.
|
||||
*
|
||||
* \sa SDL_CreateRW
|
||||
* \sa SDL_DestroyRW
|
||||
@ -410,7 +441,7 @@ static int rwops_testAllocFree(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Compare memory and file reads
|
||||
* Compare memory and file reads
|
||||
*
|
||||
* \sa SDL_RWFromMem
|
||||
* \sa SDL_RWFromFile
|
||||
@ -473,7 +504,7 @@ static int rwops_testCompareRWFromMemWithRWFromFile(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests writing and reading from file using endian aware functions.
|
||||
* Tests writing and reading from file using endian aware functions.
|
||||
*
|
||||
* \sa SDL_RWFromFile
|
||||
* \sa SDL_RWClose
|
||||
|
Reference in New Issue
Block a user