early-access version 2847
This commit is contained in:
21
externals/SDL/test/testautomation_platform.c
vendored
21
externals/SDL/test/testautomation_platform.c
vendored
@@ -54,18 +54,12 @@ int platform_testTypes(void *arg)
|
||||
int platform_testEndianessAndSwap(void *arg)
|
||||
{
|
||||
int real_byteorder;
|
||||
int real_floatwordorder = 0;
|
||||
Uint16 value = 0x1234;
|
||||
Uint16 value16 = 0xCDAB;
|
||||
Uint16 swapped16 = 0xABCD;
|
||||
Uint32 value32 = 0xEFBEADDE;
|
||||
Uint32 swapped32 = 0xDEADBEEF;
|
||||
|
||||
union {
|
||||
double d;
|
||||
Uint32 ui32[2];
|
||||
} value_double;
|
||||
|
||||
Uint64 value64, swapped64;
|
||||
value64 = 0xEFBEADDE;
|
||||
value64 <<= 32;
|
||||
@@ -73,7 +67,6 @@ int platform_testEndianessAndSwap(void *arg)
|
||||
swapped64 = 0x1234ABCD;
|
||||
swapped64 <<= 32;
|
||||
swapped64 |= 0xDEADBEEF;
|
||||
value_double.d = 3.141593;
|
||||
|
||||
if ((*((char *) &value) >> 4) == 0x1) {
|
||||
real_byteorder = SDL_BIG_ENDIAN;
|
||||
@@ -87,18 +80,6 @@ int platform_testEndianessAndSwap(void *arg)
|
||||
(SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big",
|
||||
(real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" );
|
||||
|
||||
if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) {
|
||||
real_floatwordorder = SDL_LIL_ENDIAN;
|
||||
} else if (value_double.ui32[0] == 0x400921fb && value_double.ui32[1] == 0x82c2bd7f) {
|
||||
real_floatwordorder = SDL_BIG_ENDIAN;
|
||||
}
|
||||
|
||||
/* Test endianness. */
|
||||
SDLTest_AssertCheck( real_floatwordorder == SDL_FLOATWORDORDER,
|
||||
"Machine detected as having %s endian float word order, appears to be %s endian.",
|
||||
(SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big",
|
||||
(real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown" );
|
||||
|
||||
/* Test 16 swap. */
|
||||
SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16,
|
||||
"SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X",
|
||||
@@ -544,7 +525,7 @@ static const SDLTest_TestCaseReference platformTest1 =
|
||||
{ (SDLTest_TestCaseFp)platform_testTypes, "platform_testTypes", "Tests predefined types", TEST_ENABLED};
|
||||
|
||||
static const SDLTest_TestCaseReference platformTest2 =
|
||||
{ (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianness and swap functions", TEST_ENABLED};
|
||||
{ (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED};
|
||||
|
||||
static const SDLTest_TestCaseReference platformTest3 =
|
||||
{ (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED};
|
||||
|
Reference in New Issue
Block a user