Added the automation test to the autoconf build system
authorSam Lantinga <slouken@libsdl.org>
Sat, 22 Dec 2012 17:24:42 -0800
changeset 6769 b49778d885cd
parent 6768 22c37bf0afbc
child 6770 9a111d2aa992
Added the automation test to the autoconf build system
test/Makefile.in
test/testautomation.c
test/testautomation_clipboard.c
test/testautomation_platform.c
test/testautomation_rect.c
test/testautomation_render.c
test/testautomation_rwops.c
test/testautomation_suites.h
test/tests/testclipboard.c
test/tests/testplatform.c
test/tests/testrect.c
test/tests/testrender.c
test/tests/testrwops.c
test/tests/testsuites.h
--- a/test/Makefile.in	Sat Dec 22 17:24:14 2012 -0800
+++ b/test/Makefile.in	Sat Dec 22 17:24:42 2012 -0800
@@ -11,6 +11,7 @@
 	checkkeys$(EXE) \
 	loopwave$(EXE) \
 	testaudioinfo$(EXE) \
+	testautomation$(EXE) \
 	testdraw2$(EXE) \
 	testerror$(EXE) \
 	testfile$(EXE) \
@@ -67,6 +68,14 @@
 testaudioinfo$(EXE): $(srcdir)/testaudioinfo.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
+testautomation$(EXE): $(srcdir)/testautomation.c \
+		      $(srcdir)/testautomation_clipboard.c \
+		      $(srcdir)/testautomation_platform.c \
+		      $(srcdir)/testautomation_rect.c \
+		      $(srcdir)/testautomation_render.c \
+		      $(srcdir)/testautomation_rwops.c
+	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -lSDL2_test
+
 testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
 
--- a/test/testautomation.c	Sat Dec 22 17:24:14 2012 -0800
+++ b/test/testautomation.c	Sat Dec 22 17:24:42 2012 -0800
@@ -17,7 +17,7 @@
 #include "SDL.h"
 #include "SDL_test.h"
 
-#include "tests/testsuites.h"
+#include "testautomation_suites.h"
 
 static SDLTest_CommonState *state;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_clipboard.c	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,182 @@
+/**
+ * New/updated tests: aschiffler at ferzkopp dot net
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "SDL.h"
+#include "SDL_test.h"
+
+/* ================= Test Case Implementation ================== */
+
+/* Test case functions */
+
+/**
+ * \brief Check call to SDL_HasClipboardText
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
+ */
+int
+clipboard_testHasClipboardText(void *arg)
+{
+	SDL_bool result;
+	result = SDL_HasClipboardText();
+	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
+
+    return TEST_COMPLETED;
+}
+
+/**
+ * \brief Check call to SDL_GetClipboardText
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
+ */
+int
+clipboard_testGetClipboardText(void *arg)
+{
+	char *charResult;
+	charResult = SDL_GetClipboardText();
+	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
+
+	if (charResult) SDL_free(charResult);
+
+    return TEST_COMPLETED;
+}
+
+/**
+ * \brief Check call to SDL_SetClipboardText
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
+ */
+int
+clipboard_testSetClipboardText(void *arg)
+{
+	char *textRef = SDLTest_RandomAsciiString();
+	char *text = SDL_strdup(textRef);
+	int result;
+	result = SDL_SetClipboardText((const char *)text);
+	SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
+	SDLTest_AssertCheck(
+		result == 0,
+		"Validate SDL_SetClipboardText result, expected 0, got %i",
+		result);
+	SDLTest_AssertCheck(
+		SDL_strcmp(textRef, text) == 0,
+		"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
+		textRef, text);
+
+    /* Cleanup */
+    if (textRef) SDL_free(textRef);
+    if (text) SDL_free(text);
+
+   return TEST_COMPLETED;
+}
+
+/**
+ * \brief End-to-end test of SDL_xyzClipboardText functions
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
+ */
+int
+clipboard_testClipboardTextFunctions(void *arg)
+{
+	char *textRef = SDLTest_RandomAsciiString();
+	char *text = SDL_strdup(textRef);
+	SDL_bool boolResult;
+	int intResult;
+	char *charResult;
+
+	/* Clear clipboard text state */
+	boolResult = SDL_HasClipboardText();
+	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
+	if (boolResult == SDL_TRUE) {
+        intResult = SDL_SetClipboardText((const char *)NULL);
+		SDLTest_AssertPass("Call to DL_SetClipboardText(NULL) succeeded");
+	    SDLTest_AssertCheck(
+			intResult == 0,
+			"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
+			intResult);
+	    charResult = SDL_GetClipboardText();
+		SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
+	    boolResult = SDL_HasClipboardText();
+		SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
+	    SDLTest_AssertCheck(
+            boolResult == SDL_FALSE,
+	        "Verify SDL_HasClipboardText returned SDL_FALSE, got %s",
+			(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
+    }
+
+    /* Empty clipboard  */
+	charResult = SDL_GetClipboardText();
+	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
+	SDLTest_AssertCheck(
+		charResult != NULL,
+		"Verify SDL_GetClipboardText did not return NULL");
+	SDLTest_AssertCheck(
+		strlen(charResult) == 0,
+		"Verify SDL_GetClipboardText returned string with length 0, got length %i",
+		strlen(charResult));
+    intResult = SDL_SetClipboardText((const char *)text);
+	SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
+	SDLTest_AssertCheck(
+		intResult == 0,
+		"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
+		intResult);
+	SDLTest_AssertCheck(
+		strcmp(textRef, text) == 0,
+		"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
+		textRef, text);
+	boolResult = SDL_HasClipboardText();
+	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
+	SDLTest_AssertCheck(
+        boolResult == SDL_TRUE,
+	    "Verify SDL_HasClipboardText returned SDL_TRUE, got %s",
+		(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
+	charResult = SDL_GetClipboardText();
+	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
+	SDLTest_AssertCheck(
+		strcmp(textRef, charResult) == 0,
+		"Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'",
+		textRef, charResult);
+
+    /* Cleanup */
+    if (textRef) SDL_free(textRef);
+    if (text) SDL_free(text);
+    if (charResult) SDL_free(charResult);
+
+   return TEST_COMPLETED;
+}
+
+
+/* ================= Test References ================== */
+
+/* Clipboard test cases */
+static const SDLTest_TestCaseReference clipboardTest1 =
+		{ (SDLTest_TestCaseFp)clipboard_testHasClipboardText, "clipboard_testHasClipboardText", "Check call to SDL_HasClipboardText", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference clipboardTest2 =
+		{ (SDLTest_TestCaseFp)clipboard_testGetClipboardText, "clipboard_testGetClipboardText", "Check call to SDL_GetClipboardText", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference clipboardTest3 =
+		{ (SDLTest_TestCaseFp)clipboard_testSetClipboardText, "clipboard_testSetClipboardText", "Check call to SDL_SetClipboardText", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference clipboardTest4 =
+		{ (SDLTest_TestCaseFp)clipboard_testClipboardTextFunctions, "clipboard_testClipboardTextFunctions", "End-to-end test of SDL_xyzClipboardText functions", TEST_ENABLED };
+
+/* Sequence of Clipboard test cases */
+static const SDLTest_TestCaseReference *clipboardTests[] =  {
+	&clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, NULL
+};
+
+/* Clipboard test suite (global) */
+SDLTest_TestSuiteReference clipboardTestSuite = {
+	"Clipboard",
+	NULL,
+	clipboardTests,
+	NULL
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_platform.c	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,561 @@
+/**
+ * Original code: automated SDL platform test written by Edgar Simo "bobbens"
+ * Extended and updated by aschiffler at ferzkopp dot net
+ */
+
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_test.h"
+
+/* ================= Test Case Implementation ================== */
+
+/* Helper functions */
+
+/**
+ * @brief Compare sizes of types.
+ *
+ * @note Watcom C flags these as Warning 201: "Unreachable code" if you just
+ *  compare them directly, so we push it through a function to keep the
+ *  compiler quiet.  --ryan.
+ */
+static int _compareSizeOfType( size_t sizeoftype, size_t hardcodetype )
+{
+    return sizeoftype != hardcodetype;
+}
+
+/* Test case functions */
+
+/**
+ * @brief Tests type sizes.
+ */
+int platform_testTypes(void *arg)
+{
+   int ret;
+
+   ret = _compareSizeOfType( sizeof(Uint8), 1 );
+   SDLTest_AssertCheck( ret == 0, "sizeof(Uint8) = %lu, expected  1", sizeof(Uint8) );
+
+   ret = _compareSizeOfType( sizeof(Uint16), 2 );
+   SDLTest_AssertCheck( ret == 0, "sizeof(Uint16) = %lu, expected 2", sizeof(Uint16) );
+
+   ret = _compareSizeOfType( sizeof(Uint32), 4 );
+   SDLTest_AssertCheck( ret == 0, "sizeof(Uint32) = %lu, expected 4", sizeof(Uint32) );
+
+   ret = _compareSizeOfType( sizeof(Uint64), 8 );
+   SDLTest_AssertCheck( ret == 0, "sizeof(Uint64) = %lu, expected 8", sizeof(Uint64) );
+
+   return TEST_COMPLETED;
+}
+
+/**
+ * @brief Tests platform endianness and SDL_SwapXY functions.
+ */
+int platform_testEndianessAndSwap(void *arg)
+{
+    int real_byteorder;
+    Uint16 value = 0x1234;
+    Uint16 value16 = 0xCDAB;
+    Uint16 swapped16 = 0xABCD;
+    Uint32 value32 = 0xEFBEADDE;
+    Uint32 swapped32 = 0xDEADBEEF;
+
+    Uint64 value64, swapped64;
+    value64 = 0xEFBEADDE;
+    value64 <<= 32;
+    value64 |= 0xCDAB3412;
+    swapped64 = 0x1234ABCD;
+    swapped64 <<= 32;
+    swapped64 |= 0xDEADBEEF;
+
+    if ((*((char *) &value) >> 4) == 0x1) {
+        real_byteorder = SDL_BIG_ENDIAN;
+    } else {
+        real_byteorder = SDL_LIL_ENDIAN;
+    }
+
+    /* Test endianness. */
+    SDLTest_AssertCheck( real_byteorder == SDL_BYTEORDER,
+             "Machine detected as %s endian, appears to be %s endian.",
+             (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big",
+             (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" );
+
+    /* Test 16 swap. */
+    SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16,
+             "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X",
+             value16, SDL_Swap16(value16) );
+
+    /* Test 32 swap. */
+    SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32,
+             "SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X",
+             value32, SDL_Swap32(value32) );
+
+    /* Test 64 swap. */
+    SDLTest_AssertCheck( SDL_Swap64(value64) == swapped64,
+#ifdef _MSC_VER
+             "SDL_Swap64(): 64 bit swapped: 0x%I64X => 0x%I64X",
+#else
+             "SDL_Swap64(): 64 bit swapped: 0x%llX => 0x%llX",
+#endif
+             value64, SDL_Swap64(value64) );
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_GetXYZ() functions
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetPlatform
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCount
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCacheLineSize
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetRevision
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetRevisionNumber
+ */
+int platform_testGetFunctions (void *arg)
+{
+   char *platform;
+   char *revision;
+   int ret;
+   int len;
+
+   platform = (char *)SDL_GetPlatform();
+   SDLTest_AssertPass("SDL_GetPlatform()");
+   SDLTest_AssertCheck(platform != NULL, "SDL_GetPlatform() != NULL");
+   if (platform != NULL) {
+     len = strlen(platform);
+     SDLTest_AssertCheck(len > 0,
+             "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i",
+             platform,
+             len);
+   }
+
+   ret = SDL_GetCPUCount();
+   SDLTest_AssertPass("SDL_GetCPUCount()");
+   SDLTest_AssertCheck(ret > 0,
+             "SDL_GetCPUCount(): expected count > 0, was: %i",
+             ret);
+
+   ret = SDL_GetCPUCacheLineSize();
+   SDLTest_AssertPass("SDL_GetCPUCacheLineSize()");
+   SDLTest_AssertCheck(ret >= 0,
+             "SDL_GetCPUCacheLineSize(): expected size >= 0, was: %i",
+             ret);
+
+   revision = (char *)SDL_GetRevision();
+   SDLTest_AssertPass("SDL_GetRevision()");
+   SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
+
+   ret = SDL_GetRevisionNumber();
+   SDLTest_AssertPass("SDL_GetRevisionNumber()");
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasXYZ() functions
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_Has3DNow
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasAltiVec
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasMMX
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasRDTSC
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE2
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE3
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE41
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE42
+ */
+int platform_testHasFunctions (void *arg)
+{
+   int ret;
+
+   // TODO: independently determine and compare values as well
+
+   ret = SDL_HasRDTSC();
+   SDLTest_AssertPass("SDL_HasRDTSC()");
+
+   ret = SDL_HasAltiVec();
+   SDLTest_AssertPass("SDL_HasAltiVec()");
+
+   ret = SDL_HasMMX();
+   SDLTest_AssertPass("SDL_HasMMX()");
+
+   ret = SDL_Has3DNow();
+   SDLTest_AssertPass("SDL_Has3DNow()");
+
+   ret = SDL_HasSSE();
+   SDLTest_AssertPass("SDL_HasSSE()");
+
+   ret = SDL_HasSSE2();
+   SDLTest_AssertPass("SDL_HasSSE2()");
+
+   ret = SDL_HasSSE3();
+   SDLTest_AssertPass("SDL_HasSSE3()");
+
+   ret = SDL_HasSSE41();
+   SDLTest_AssertPass("SDL_HasSSE41()");
+
+   ret = SDL_HasSSE42();
+   SDLTest_AssertPass("SDL_HasSSE42()");
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_GetVersion
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetVersion
+ */
+int platform_testGetVersion(void *arg)
+{
+   SDL_version linked;
+   int major = SDL_MAJOR_VERSION;
+   int minor = SDL_MINOR_VERSION;
+
+   SDL_GetVersion(&linked);
+   SDLTest_AssertCheck( linked.major >= major,
+             "SDL_GetVersion(): returned major %i (>= %i)",
+             linked.major,
+             major);
+   SDLTest_AssertCheck( linked.minor >= minor,
+             "SDL_GetVersion(): returned minor %i (>= %i)",
+             linked.minor,
+             minor);
+
+   return TEST_COMPLETED;
+}
+
+
+/*!
+ * \brief Tests SDL_VERSION macro
+ */
+int platform_testSDLVersion(void *arg)
+{
+   SDL_version compiled;
+   int major = SDL_MAJOR_VERSION;
+   int minor = SDL_MINOR_VERSION;
+
+   SDL_VERSION(&compiled);
+   SDLTest_AssertCheck( compiled.major >= major,
+             "SDL_VERSION() returned major %i (>= %i)",
+             compiled.major,
+             major);
+   SDLTest_AssertCheck( compiled.minor >= minor,
+             "SDL_VERSION() returned minor %i (>= %i)",
+             compiled.minor,
+             minor);
+
+   return TEST_COMPLETED;
+}
+
+
+/*!
+ * \brief Tests default SDL_Init
+ */
+int platform_testDefaultInit(void *arg)
+{
+   int ret;
+   int subsystem;
+
+   subsystem = SDL_WasInit(SDL_INIT_EVERYTHING);
+   SDLTest_AssertCheck( subsystem != 0,
+             "SDL_WasInit(0): returned %i, expected != 0",
+             subsystem);
+
+   ret = SDL_Init(SDL_WasInit(SDL_INIT_EVERYTHING));
+   SDLTest_AssertCheck( ret == 0,
+             "SDL_Init(0): returned %i, expected 0, error: %s",
+             ret,
+             SDL_GetError());
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_Get/Set/ClearError
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetError
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetError
+ * http://wiki.libsdl.org/moin.cgi/SDL_ClearError
+ */
+int platform_testGetSetClearError(void *arg)
+{
+   const char *testError = "Testing";
+   char *lastError;
+   int len;
+
+   SDL_ClearError();
+   SDLTest_AssertPass("SDL_ClearError()");
+
+   lastError = (char *)SDL_GetError();
+   SDLTest_AssertPass("SDL_GetError()");
+   SDLTest_AssertCheck(lastError != NULL,
+             "SDL_GetError() != NULL");
+   if (lastError != NULL)
+   {
+     len = strlen(lastError);
+     SDLTest_AssertCheck(len == 0,
+             "SDL_GetError(): no message expected, len: %i", len);
+   }
+
+   SDL_SetError("%s", testError);
+   SDLTest_AssertPass("SDL_SetError()");
+   lastError = (char *)SDL_GetError();
+   SDLTest_AssertCheck(lastError != NULL,
+             "SDL_GetError() != NULL");
+   if (lastError != NULL)
+   {
+     len = strlen(lastError);
+     SDLTest_AssertCheck(len == strlen(testError),
+             "SDL_GetError(): expected message len %i, was len: %i",
+             strlen(testError),
+             len);
+     SDLTest_AssertCheck(strcmp(lastError, testError) == 0,
+             "SDL_GetError(): expected message %s, was message: %s",
+             testError,
+             lastError);
+   }
+
+   // Clean up
+   SDL_ClearError();
+   SDLTest_AssertPass("SDL_ClearError()");
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_SetError with empty input
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetError
+ */
+int platform_testSetErrorEmptyInput(void *arg)
+{
+   const char *testError = "";
+   char *lastError;
+   int len;
+
+   SDL_SetError("%s", testError);
+   SDLTest_AssertPass("SDL_SetError()");
+   lastError = (char *)SDL_GetError();
+   SDLTest_AssertCheck(lastError != NULL,
+             "SDL_GetError() != NULL");
+   if (lastError != NULL)
+   {
+     len = strlen(lastError);
+     SDLTest_AssertCheck(len == strlen(testError),
+             "SDL_GetError(): expected message len %i, was len: %i",
+             strlen(testError),
+             len);
+     SDLTest_AssertCheck(strcmp(lastError, testError) == 0,
+             "SDL_GetError(): expected message '%s', was message: '%s'",
+             testError,
+             lastError);
+   }
+
+   // Clean up
+   SDL_ClearError();
+   SDLTest_AssertPass("SDL_ClearError()");
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_SetError with invalid input
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetError
+ */
+int platform_testSetErrorInvalidInput(void *arg)
+{
+   const char *testError = NULL;
+   const char *probeError = "Testing";
+   char *lastError;
+   int len;
+
+   // Reset
+   SDL_ClearError();
+   SDLTest_AssertPass("SDL_ClearError()");
+
+   // Check for no-op
+   SDL_SetError(testError);
+   SDLTest_AssertPass("SDL_SetError()");
+   lastError = (char *)SDL_GetError();
+   SDLTest_AssertCheck(lastError != NULL,
+             "SDL_GetError() != NULL");
+   if (lastError != NULL)
+   {
+     len = strlen(lastError);
+     SDLTest_AssertCheck(len == 0,
+             "SDL_GetError(): expected message len 0, was len: %i",
+             0,
+             len);
+     SDLTest_AssertCheck(strcmp(lastError, "") == 0,
+             "SDL_GetError(): expected message '', was message: '%s'",
+             lastError);
+   }
+
+   // Set
+   SDL_SetError(probeError);
+   SDLTest_AssertPass("SDL_SetError()");
+
+   // Check for no-op
+   SDL_SetError(testError);
+   SDLTest_AssertPass("SDL_SetError()");
+   lastError = (char *)SDL_GetError();
+   SDLTest_AssertCheck(lastError != NULL,
+             "SDL_GetError() != NULL");
+   if (lastError != NULL)
+   {
+     len = strlen(lastError);
+     SDLTest_AssertCheck(len == strlen(probeError),
+             "SDL_GetError(): expected message len %i, was len: %i",
+             strlen(probeError),
+             len);
+     SDLTest_AssertCheck(strcmp(lastError, probeError) == 0,
+             "SDL_GetError(): expected message '%s', was message: '%s'",
+             probeError,
+             lastError);
+   }
+
+   // Clean up
+   SDL_ClearError();
+   SDLTest_AssertPass("SDL_ClearError()");
+
+   return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_GetPowerInfo
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetPowerInfo
+ */
+int platform_testGetPowerInfo(void *arg)
+{
+   SDL_PowerState state;
+   SDL_PowerState stateAgain;
+   int secs;
+   int secsAgain;
+   int pct;
+   int pctAgain;
+
+   state = SDL_GetPowerInfo(&secs, &pct);
+   SDLTest_AssertPass("SDL_GetPowerInfo()");
+   SDLTest_AssertCheck(
+       state==SDL_POWERSTATE_UNKNOWN ||
+       state==SDL_POWERSTATE_ON_BATTERY ||
+       state==SDL_POWERSTATE_NO_BATTERY ||
+       state==SDL_POWERSTATE_CHARGING ||
+       state==SDL_POWERSTATE_CHARGED,
+       "SDL_GetPowerInfo(): state %i is one of the expected values",
+       (int)state);
+
+   if (state==SDL_POWERSTATE_ON_BATTERY)
+   {
+      SDLTest_AssertCheck(
+         secs >= 0,
+         "SDL_GetPowerInfo(): on battery, secs >= 0, was: %i",
+         secs);
+      SDLTest_AssertCheck(
+         (pct >= 0) && (pct <= 100),
+         "SDL_GetPowerInfo(): on battery, pct=[0,100], was: %i",
+         pct);
+   }
+
+   if (state==SDL_POWERSTATE_UNKNOWN ||
+       state==SDL_POWERSTATE_NO_BATTERY)
+   {
+      SDLTest_AssertCheck(
+         secs == -1,
+         "SDL_GetPowerInfo(): no battery, secs == -1, was: %i",
+         secs);
+      SDLTest_AssertCheck(
+         pct == -1,
+         "SDL_GetPowerInfo(): no battery, pct == -1, was: %i",
+         pct);
+   }
+
+   // Partial return value variations
+   stateAgain = SDL_GetPowerInfo(&secsAgain, NULL);
+   SDLTest_AssertCheck(
+        state==stateAgain,
+        "State %i returned when only 'secs' requested",
+        stateAgain);
+   SDLTest_AssertCheck(
+        secs==secsAgain,
+        "Value %i matches when only 'secs' requested",
+        secsAgain);
+   stateAgain = SDL_GetPowerInfo(NULL, &pctAgain);
+   SDLTest_AssertCheck(
+        state==stateAgain,
+        "State %i returned when only 'pct' requested",
+        stateAgain);
+   SDLTest_AssertCheck(
+        pct==pctAgain,
+        "Value %i matches when only 'pct' requested",
+        pctAgain);
+   stateAgain = SDL_GetPowerInfo(NULL, NULL);
+   SDLTest_AssertCheck(
+        state==stateAgain,
+        "State %i returned when no value requested",
+        stateAgain);
+
+   return TEST_COMPLETED;
+}
+
+/* ================= Test References ================== */
+
+/* Platform test cases */
+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 endianess and swap functions", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest3 =
+		{ (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest4 =
+		{ (SDLTest_TestCaseFp)platform_testHasFunctions, "platform_testHasFunctions", "Tests various SDL_HasXYZ functions", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest5 =
+		{ (SDLTest_TestCaseFp)platform_testGetVersion, "platform_testGetVersion", "Tests SDL_GetVersion function", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest6 =
+		{ (SDLTest_TestCaseFp)platform_testSDLVersion, "platform_testSDLVersion", "Tests SDL_VERSION macro", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest7 =
+		{ (SDLTest_TestCaseFp)platform_testDefaultInit, "platform_testDefaultInit", "Tests default SDL_Init", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest8 =
+		{ (SDLTest_TestCaseFp)platform_testGetSetClearError, "platform_testGetSetClearError", "Tests SDL_Get/Set/ClearError", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest9 =
+		{ (SDLTest_TestCaseFp)platform_testSetErrorEmptyInput, "platform_testSetErrorEmptyInput", "Tests SDL_SetError with empty input", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest10 =
+		{ (SDLTest_TestCaseFp)platform_testSetErrorInvalidInput, "platform_testSetErrorInvalidInput", "Tests SDL_SetError with invalid input", TEST_ENABLED};
+
+static const SDLTest_TestCaseReference platformTest11 =
+		{ (SDLTest_TestCaseFp)platform_testGetPowerInfo, "platform_testGetPowerInfo", "Tests SDL_GetPowerInfo function", TEST_ENABLED };
+
+/* Sequence of Platform test cases */
+static const SDLTest_TestCaseReference *platformTests[] =  {
+	&platformTest1,
+	&platformTest2,
+	&platformTest3,
+	&platformTest4,
+	&platformTest5,
+	&platformTest6,
+	&platformTest7,
+	&platformTest8,
+	&platformTest9,
+	&platformTest10,
+	&platformTest11,
+	NULL
+};
+
+/* Platform test suite (global) */
+SDLTest_TestSuiteReference platformTestSuite = {
+	"Platform",
+	NULL,
+	platformTests,
+	NULL
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_rect.c	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,1677 @@
+/**
+ * Original code: automated SDL rect test written by Edgar Simo "bobbens"
+ * New/updated tests: aschiffler at ferzkopp dot net
+ */
+
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_test.h"
+
+/* ================= Test Case Implementation ================== */
+
+/* Helper functions */
+
+/*!
+ * \brief Private helper to check SDL_IntersectRectAndLine results
+ */
+void _validateIntersectRectAndLineResults(
+    SDL_bool intersection, SDL_bool expectedIntersection,
+    SDL_Rect *rect, SDL_Rect * refRect,
+    int x1, int y1, int x2, int y2,
+    int x1Ref, int y1Ref, int x2Ref, int y2Ref)
+{
+    SDLTest_AssertCheck(intersection == expectedIntersection, 
+        "Check for correct intersection result: expected %s, got %s intersecting rect (%d,%d,%d,%d) with line (%d,%d - %d,%d)",
+        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        refRect->x, refRect->y, refRect->w, refRect->h,
+        x1Ref, y1Ref, x2Ref, y2Ref);
+    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
+        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rect->x, rect->y, rect->w, rect->h,
+        refRect->x, refRect->y, refRect->w, refRect->h);
+    SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
+        "Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
+        x1, y1, x2, y2,
+        x1Ref, y1Ref, x2Ref, y2Ref);
+}
+
+/* Test case functions */
+
+/*!
+ * \brief Tests SDL_IntersectRectAndLine() clipping cases
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
+ */
+int 
+rect_testIntersectRectAndLine (void *arg)
+{
+    SDL_Rect refRect = { 0, 0, 32, 32 };
+    SDL_Rect rect;
+    int x1, y1;
+    int x2, y2;
+    SDL_bool intersected;
+
+    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
+    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
+    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
+    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
+
+    x1 = xLeft;
+    y1 = 15;
+    x2 = xRight;
+    y2 = 15;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15);
+
+    x1 = 15;
+    y1 = yTop;
+    x2 = 15;
+    y2 = yBottom;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31);
+
+    x1 = -refRect.w;
+    y1 = -refRect.h;
+    x2 = 2*refRect.w;
+    y2 = 2*refRect.h;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+     _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31);
+
+    x1 = 2*refRect.w;
+    y1 = 2*refRect.h;
+    x2 = -refRect.w;
+    y2 = -refRect.h;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0);
+
+    x1 = -1;
+    y1 = 32;
+    x2 = 32;
+    y2 = -1;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0);
+
+    x1 = 32;
+    y1 = -1;
+    x2 = -1;
+    y2 = 32;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
+ */
+int 
+rect_testIntersectRectAndLineInside (void *arg)
+{
+    SDL_Rect refRect = { 0, 0, 32, 32 };
+    SDL_Rect rect;
+    int x1, y1;
+    int x2, y2;
+    SDL_bool intersected;
+
+    int xmin = refRect.x;
+    int xmax = refRect.x + refRect.w - 1;
+    int ymin = refRect.y;
+    int ymax = refRect.y + refRect.h - 1;
+    int x1Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
+    int y1Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
+    int x2Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
+    int y2Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
+
+    x1 = x1Ref;
+    y1 = y1Ref;
+    x2 = x2Ref;
+    y2 = y2Ref;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
+
+    x1 = x1Ref;
+    y1 = y1Ref;
+    x2 = xmax;
+    y2 = ymax;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax);
+
+    x1 = xmin;
+    y1 = ymin;
+    x2 = x2Ref;
+    y2 = y2Ref;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref);
+
+    x1 = xmin;
+    y1 = ymin;
+    x2 = xmax;
+    y2 = ymax;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax);
+
+    x1 = xmin;
+    y1 = ymax;
+    x2 = xmax;
+    y2 = ymin;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
+ */
+int 
+rect_testIntersectRectAndLineOutside (void *arg)
+{
+    SDL_Rect refRect = { 0, 0, 32, 32 };
+    SDL_Rect rect;
+    int x1, y1;
+    int x2, y2;
+    SDL_bool intersected;
+
+    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
+    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
+    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
+    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
+
+    x1 = xLeft;
+    y1 = 0;
+    x2 = xLeft;
+    y2 = 31;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31);
+
+    x1 = xRight;
+    y1 = 0;
+    x2 = xRight;
+    y2 = 31;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31);
+
+    x1 = 0;
+    y1 = yTop;
+    x2 = 31;
+    y2 = yTop;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop);
+
+    x1 = 0;
+    y1 = yBottom;
+    x2 = 31;
+    y2 = yBottom;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRectAndLine() with empty rectangle
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
+ */
+int 
+rect_testIntersectRectAndLineEmpty (void *arg)
+{
+    SDL_Rect refRect;
+    SDL_Rect rect;
+    int x1, y1, x1Ref, y1Ref;
+    int x2, y2, x2Ref, y2Ref;
+    SDL_bool intersected;
+        
+    refRect.x = SDLTest_RandomIntegerInRange(1, 1024);
+    refRect.y = SDLTest_RandomIntegerInRange(1, 1024);
+    refRect.w = 0;
+    refRect.h = 0;
+    x1Ref = refRect.x;
+    y1Ref = refRect.y;
+    x2Ref = SDLTest_RandomIntegerInRange(1, 1024);
+    y2Ref = SDLTest_RandomIntegerInRange(1, 1024);
+
+    x1 = x1Ref;
+    y1 = y1Ref;
+    x2 = x2Ref;
+    y2 = y2Ref;
+    rect = refRect;
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
+ */
+int 
+rect_testIntersectRectAndLineParam (void *arg)
+{
+    SDL_Rect rect = { 0, 0, 32, 32 };
+    int x1 = rect.w / 2;
+    int y1 = rect.h / 2;
+    int x2 = x1;
+    int y2 = 2 * rect.h;
+    SDL_bool intersected;
+    
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
+    SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE");
+    
+    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
+    intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL");
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL");
+    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL");
+    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
+    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Private helper to check SDL_HasIntersection results
+ */
+void _validateHasIntersectionResults(
+    SDL_bool intersection, SDL_bool expectedIntersection, 
+    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
+{
+    SDLTest_AssertCheck(intersection == expectedIntersection, 
+        "Check intersection result: expected %s, got %s intersecting A (%d,%d,%d,%d) with B (%d,%d,%d,%d)",
+        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        rectA->x, rectA->y, rectA->w, rectA->h, 
+        rectB->x, rectB->y, rectB->w, rectB->h);
+    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
+        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectA->x, rectA->y, rectA->w, rectA->h,
+        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
+    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
+        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectB->x, rectB->y, rectB->w, rectB->h,
+        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
+}
+
+/*!
+ * \brief Private helper to check SDL_IntersectRect results
+ */
+void _validateIntersectRectResults(
+    SDL_bool intersection, SDL_bool expectedIntersection, 
+    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
+    SDL_Rect *result, SDL_Rect *expectedResult)
+{
+    _validateHasIntersectionResults(intersection, expectedIntersection, rectA, rectB, refRectA, refRectB);
+    if (result && expectedResult) {
+        SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
+            "Check that intersection of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+            rectA->x, rectA->y, rectA->w, rectA->h, 
+            rectB->x, rectB->y, rectB->w, rectB->h,
+            result->x, result->y, result->w, result->h,
+            expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
+    }
+}
+
+/*!
+ * \brief Private helper to check SDL_UnionRect results
+ */
+void _validateUnionRectResults(
+    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
+    SDL_Rect *result, SDL_Rect *expectedResult)
+{
+    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
+        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectA->x, rectA->y, rectA->w, rectA->h,
+        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
+    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
+        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectB->x, rectB->y, rectB->w, rectB->h,
+        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
+    SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
+        "Check that union of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectA->x, rectA->y, rectA->w, rectA->h, 
+        rectB->x, rectB->y, rectB->w, rectB->h,
+        result->x, result->y, result->w, result->h,
+        expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
+}
+
+/*!
+ * \brief Private helper to check SDL_RectEmpty results
+ */
+void _validateRectEmptyResults(
+    SDL_bool empty, SDL_bool expectedEmpty, 
+    SDL_Rect *rect, SDL_Rect *refRect)
+{
+    SDLTest_AssertCheck(empty == expectedEmpty, 
+        "Check for correct empty result: expected %s, got %s testing (%d,%d,%d,%d)",
+        (expectedEmpty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        rect->x, rect->y, rect->w, rect->h);
+    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
+        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rect->x, rect->y, rect->w, rect->h,
+        refRect->x, refRect->y, refRect->w, refRect->h);
+}
+
+/*!
+ * \brief Private helper to check SDL_RectEquals results
+ */
+void _validateRectEqualsResults(
+    SDL_bool equals, SDL_bool expectedEquals, 
+    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
+{
+    SDLTest_AssertCheck(equals == expectedEquals, 
+        "Check for correct equals result: expected %s, got %s testing (%d,%d,%d,%d) and (%d,%d,%d,%d)",
+        (expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        (equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+        rectA->x, rectA->y, rectA->w, rectA->h,
+        rectB->x, rectB->y, rectB->w, rectB->h);
+    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
+        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectA->x, rectA->y, rectA->w, rectA->h,
+        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
+    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
+        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
+        rectB->x, rectB->y, rectB->w, rectB->h,
+        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
+}
+
+/*!
+ * \brief Tests SDL_IntersectRect() with B fully inside A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectInside (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_bool intersection;
+
+    // rectB fully contained in rectA
+    refRectB.x = 0;
+    refRectB.y = 0;
+    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRect() with B fully outside A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectOutside (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_bool intersection;
+
+    // rectB fully outside of rectA
+    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
+    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
+    refRectB.w = refRectA.w;
+    refRectB.h = refRectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);    
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRect() with B partially intersecting A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectPartial (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_Rect expectedResult;
+    SDL_bool intersection;
+
+    // rectB partially contained in rectA
+    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
+    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
+    refRectB.w = refRectA.w;
+    refRectB.h = refRectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    expectedResult.x = refRectB.x;
+    expectedResult.y = refRectB.y;
+    expectedResult.w = refRectA.w - refRectB.x;
+    expectedResult.h = refRectA.h - refRectB.y;    
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    // rectB right edge
+    refRectB.x = rectA.w - 1;
+    refRectB.y = rectA.y;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    expectedResult.x = refRectB.x;
+    expectedResult.y = refRectB.y;
+    expectedResult.w = 1;
+    expectedResult.h = refRectB.h;    
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    // rectB left edge
+    refRectB.x = 1 - rectA.w;
+    refRectB.y = rectA.y;
+    refRectB.w = refRectA.w;
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    expectedResult.x = 0;
+    expectedResult.y = refRectB.y;
+    expectedResult.w = 1;
+    expectedResult.h = refRectB.h;    
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    // rectB bottom edge
+    refRectB.x = rectA.x;
+    refRectB.y = rectA.h - 1;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    expectedResult.x = refRectB.x;
+    expectedResult.y = refRectB.y;
+    expectedResult.w = refRectB.w;
+    expectedResult.h = 1;    
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    // rectB top edge
+    refRectB.x = rectA.x;
+    refRectB.y = 1 - rectA.h;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = rectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    expectedResult.x = refRectB.x;
+    expectedResult.y = 0;
+    expectedResult.w = refRectB.w;
+    expectedResult.h = 1;    
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectPoint (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 1, 1 };
+    SDL_Rect refRectB = { 0, 0, 1, 1 };
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_bool intersection;
+    int offsetX, offsetY;
+
+    // intersecting pixels
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB.x = refRectA.x;
+    refRectB.y = refRectA.y;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
+
+    // non-intersecting pixels cases
+    for (offsetX = -1; offsetX <= 1; offsetX++) {
+        for (offsetY = -1; offsetY <= 1; offsetY++) {
+            if (offsetX != 0 || offsetY != 0) {
+                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+                refRectB.x = refRectA.x;
+                refRectB.y = refRectA.y;    
+                refRectB.x += offsetX;
+                refRectB.y += offsetY;
+                rectA = refRectA;
+                rectB = refRectB;
+                intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+                _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+            }
+        }
+    }
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_IntersectRect() with empty rectangles
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectEmpty (void *arg)
+{
+    SDL_Rect refRectA;
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_bool intersection;
+
+    // Rect A empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectA.w = 0;
+    refRectA.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+
+    // Rect B empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectB.w = 0;
+    refRectB.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+
+    // Rect A and B empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectA.w = 0;
+    refRectA.h = 0;
+    refRectB.w = 0;
+    refRectB.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
+    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_IntersectRect() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
+ */
+int rect_testIntersectRectParam(void *arg)
+{
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_Rect result;
+    SDL_bool intersection;
+
+    // invalid parameter combinations
+    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
+    intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
+    intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL"); 
+    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL"); 
+    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL "); 
+    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasIntersection() with B fully inside A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionInside (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+
+    // rectB fully contained in rectA
+    refRectB.x = 0;
+    refRectB.y = 0;
+    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasIntersection() with B fully outside A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionOutside (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+
+    // rectB fully outside of rectA
+    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
+    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
+    refRectB.w = refRectA.w;
+    refRectB.h = refRectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasIntersection() with B partially intersecting A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionPartial (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 32, 32 };
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+
+    // rectB partially contained in rectA
+    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
+    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
+    refRectB.w = refRectA.w;
+    refRectB.h = refRectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // rectB right edge
+    refRectB.x = rectA.w - 1;
+    refRectB.y = rectA.y;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // rectB left edge
+    refRectB.x = 1 - rectA.w;
+    refRectB.y = rectA.y;
+    refRectB.w = refRectA.w;
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // rectB bottom edge
+    refRectB.x = rectA.x;
+    refRectB.y = rectA.h - 1;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // rectB top edge
+    refRectB.x = rectA.x;
+    refRectB.y = 1 - rectA.h;
+    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
+    refRectB.h = rectA.h;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionPoint (void *arg)
+{
+    SDL_Rect refRectA = { 0, 0, 1, 1 };
+    SDL_Rect refRectB = { 0, 0, 1, 1 };
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+    int offsetX, offsetY;
+
+    // intersecting pixels
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB.x = refRectA.x;
+    refRectB.y = refRectA.y;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // non-intersecting pixels cases
+    for (offsetX = -1; offsetX <= 1; offsetX++) {
+        for (offsetY = -1; offsetY <= 1; offsetY++) {
+            if (offsetX != 0 || offsetY != 0) {
+                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+                refRectB.x = refRectA.x;
+                refRectB.y = refRectA.y;    
+                refRectB.x += offsetX;
+                refRectB.y += offsetY;
+                rectA = refRectA;
+                rectB = refRectB;
+                intersection = SDL_HasIntersection(&rectA, &rectB);
+                _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
+            }
+        }
+    }
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_HasIntersection() with empty rectangles
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionEmpty (void *arg)
+{
+    SDL_Rect refRectA;
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+
+    // Rect A empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectA.w = 0;
+    refRectA.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // Rect B empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectB.w = 0;
+    refRectB.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
+
+    // Rect A and B empty
+    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
+    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
+    refRectB = refRectA;
+    refRectA.w = 0;
+    refRectA.h = 0;
+    refRectB.w = 0;
+    refRectB.h = 0;
+    rectA = refRectA;
+    rectB = refRectB;
+    intersection = SDL_HasIntersection(&rectA, &rectB);
+    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_HasIntersection() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
+ */
+int rect_testHasIntersectionParam(void *arg)
+{
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool intersection;
+
+    // invalid parameter combinations
+    intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
+    intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
+    intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Test SDL_EnclosePoints() without clipping
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
+ */
+int rect_testEnclosePoints(void *arg)
+{
+    const int numPoints = 16;
+    SDL_Point refPoints[16];
+    SDL_Point points[16];
+    SDL_Rect result;
+    SDL_bool anyEnclosed;
+    SDL_bool anyEnclosedNoResult;
+
+    // Create input data, tracking result
+    SDL_bool expectedEnclosed = SDL_TRUE;
+    int newx, newy;
+    int minx, maxx, miny, maxy;
+    int i;
+    for (i=0; i<numPoints; i++) {
+        newx = SDLTest_RandomIntegerInRange(-1024, 1024);
+        newy = SDLTest_RandomIntegerInRange(-1024, 1024);
+        refPoints[i].x = newx;
+        refPoints[i].y = newy;
+        points[i].x = newx;
+        points[i].y = newy;
+        if (i==0) {
+            minx=maxx=newx;
+            miny=maxy=newy;
+        } else {
+            if (newx<minx) minx=newx;
+            if (newx>maxx) maxx=newx;
+            if (newy<miny) miny=newy;
+            if (newy>maxy) maxy=newy;
+        }
+    }
+    
+    // Call function and validate - special case: no result requested
+    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
+        "Check expected return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+
+    // Call function and validate
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
+        "Check return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+    SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
+        "Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
+        minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Test SDL_EnclosePoints() with repeated input points
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
+ */
+int rect_testEnclosePointsRepeatedInput(void *arg)
+{
+    const int numPoints = 8;
+    const int halfPoints = 4;
+    SDL_Point refPoints[8];
+    SDL_Point points[8];
+    SDL_Rect result;
+    SDL_bool anyEnclosed;
+    SDL_bool anyEnclosedNoResult;
+
+    // Create input data, tracking result
+    SDL_bool expectedEnclosed = SDL_TRUE;
+    int newx, newy;
+    int minx, maxx, miny, maxy;
+    int i;
+    for (i=0; i<numPoints; i++) {
+        if (i < halfPoints) {
+            newx = SDLTest_RandomIntegerInRange(-1024, 1024);
+            newy = SDLTest_RandomIntegerInRange(-1024, 1024);
+        } else {
+            newx = refPoints[i-halfPoints].x;
+            newy = refPoints[i-halfPoints].y;
+        }
+        refPoints[i].x = newx;
+        refPoints[i].y = newy;
+        points[i].x = newx;
+        points[i].y = newy;
+        if (i==0) {
+            minx=maxx=newx;
+            miny=maxy=newy;
+        } else {
+            if (newx<minx) minx=newx;
+            if (newx>maxx) maxx=newx;
+            if (newy<miny) miny=newy;
+            if (newy>maxy) maxy=newy;
+        }
+    }
+
+    // Call function and validate - special case: no result requested
+    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
+        "Check return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+    
+    // Call function and validate
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
+        "Check return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+    SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
+        "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
+        minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Test SDL_EnclosePoints() with clipping
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
+ */
+int rect_testEnclosePointsWithClipping(void *arg)
+{
+    const int numPoints = 16;
+    SDL_Point refPoints[16];
+    SDL_Point points[16];
+    SDL_Rect refClip;
+    SDL_Rect clip;
+    SDL_Rect result;
+    SDL_bool anyEnclosed;
+    SDL_bool anyEnclosedNoResult;
+    SDL_bool expectedEnclosed = SDL_FALSE;
+    int newx, newy;
+    int minx, maxx, miny, maxy;
+    int i;
+
+    // Setup clipping rectangle
+    refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
+    refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
+    refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
+    refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
+
+    // Create input data, tracking result
+    for (i=0; i<numPoints; i++) {
+        newx = SDLTest_RandomIntegerInRange(-1024, 1024);
+        newy = SDLTest_RandomIntegerInRange(-1024, 1024);
+        refPoints[i].x = newx;
+        refPoints[i].y = newy;
+        points[i].x = newx;
+        points[i].y = newy;
+        if ((newx>=refClip.x) && (newx<(refClip.x + refClip.w)) &&
+            (newy>=refClip.y) && (newy<(refClip.y + refClip.h))) {
+            if (expectedEnclosed==SDL_FALSE) {
+                minx=maxx=newx;
+                miny=maxy=newy;
+            } else {
+                if (newx<minx) minx=newx;
+                if (newx>maxx) maxx=newx;
+                if (newy<miny) miny=newy;
+                if (newy>maxy) maxy=newy;
+            }
+            expectedEnclosed = SDL_TRUE;
+        }
+    }
+
+    // Call function and validate - special case: no result requested
+    clip = refClip;
+    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
+        "Expected return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+    SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
+        "Check that source clipping rectangle was not modified");
+    
+    // Call function and validate
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
+        "Check return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    for (i=0; i<numPoints; i++) {
+        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
+            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
+            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
+    }
+    SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
+        "Check that source clipping rectangle was not modified");
+    if (expectedEnclosed==SDL_TRUE) {
+        SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
+            "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
+            minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
+    }    
+    
+    /* Empty clipping rectangle */
+    clip.w = 0;
+    clip.h = 0;
+    expectedEnclosed = SDL_FALSE;
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
+        "Check return value %s, got %s", 
+        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
+		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");    
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_EnclosePoints() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
+ */
+int rect_testEnclosePointsParam(void *arg)
+{
+    SDL_Point points[1];
+    int count;
+    SDL_Rect clip;
+    SDL_Rect result;
+    SDL_bool anyEnclosed;
+
+    // invalid parameter combinations
+    anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL"); 
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is 0");
+    count = SDLTest_RandomIntegerInRange(-100, -1);
+    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is %i (negative)", count); 
+    anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result);
+    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL and 2nd parameter was 0"); 
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_UnionRect() where rect B is outside rect A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
+ */
+int rect_testUnionRectOutside(void *arg)
+{
+    SDL_Rect refRectA, refRectB;
+    SDL_Rect rectA, rectB;
+    SDL_Rect expectedResult;
+    SDL_Rect result;
+    int minx, maxx, miny, maxy;
+    int dx, dy;
+    
+    /* Union 1x1 outside */
+    for (dx = -1; dx < 2; dx++) {     
+        for (dy = -1; dy < 2; dy++) {
+            if ((dx != 0) || (dy != 0)) {
+                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.w=1;
+                refRectA.h=1;
+                refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
+                refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
+                refRectB.w=1;
+                refRectB.h=1;
+                minx = (refRectA.x<refRectB.x) ? refRectA.x : refRectB.x;
+                maxx = (refRectA.x>refRectB.x) ? refRectA.x : refRectB.x;
+                miny = (refRectA.y<refRectB.y) ? refRectA.y : refRectB.y;
+                maxy = (refRectA.y>refRectB.y) ? refRectA.y : refRectB.y;                
+                expectedResult.x = minx;
+                expectedResult.y = miny;
+                expectedResult.w = maxx - minx + 1;
+                expectedResult.h = maxy - miny + 1;
+                rectA = refRectA;
+                rectB = refRectB;
+                SDL_UnionRect(&rectA, &rectB, &result);
+                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+            }
+        }
+    }
+
+    /* Union outside overlap */
+    for (dx = -1; dx < 2; dx++) {     
+        for (dy = -1; dy < 2; dy++) {
+            if ((dx != 0) || (dy != 0)) {
+                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.w=SDLTest_RandomIntegerInRange(256, 512);
+                refRectA.h=SDLTest_RandomIntegerInRange(256, 512);
+                refRectB.x=refRectA.x + 1 + dx*2;
+                refRectB.y=refRectA.y + 1 + dy*2;
+                refRectB.w=refRectA.w - 2;
+                refRectB.h=refRectA.h - 2;
+                expectedResult = refRectA;
+                if (dx == -1) expectedResult.x--;
+                if (dy == -1) expectedResult.y--;
+                if ((dx == 1) || (dx == -1)) expectedResult.w++;
+                if ((dy == 1) || (dy == -1)) expectedResult.h++;
+                rectA = refRectA;
+                rectB = refRectB;
+                SDL_UnionRect(&rectA, &rectB, &result);
+                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+            }
+        }
+    }
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_UnionRect() where rect A or rect B are empty
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
+ */
+int rect_testUnionRectEmpty(void *arg)
+{
+    SDL_Rect refRectA, refRectB;
+    SDL_Rect rectA, rectB;
+    SDL_Rect expectedResult;
+    SDL_Rect result;
+
+    /* A empty */    
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=0;
+    refRectA.h=0;
+    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.w=SDLTest_RandomIntegerInRange(1, 1024);
+    refRectB.h=SDLTest_RandomIntegerInRange(1, 1024);
+    expectedResult = refRectB;
+    rectA = refRectA;
+    rectB = refRectB;
+    SDL_UnionRect(&rectA, &rectB, &result);
+    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+    
+    /* B empty */    
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
+    refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
+    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.w=0;
+    refRectB.h=0;
+    expectedResult = refRectA;
+    rectA = refRectA;
+    rectB = refRectB;
+    SDL_UnionRect(&rectA, &rectB, &result);
+    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    /* A and B empty */    
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=0;
+    refRectA.h=0;
+    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectB.w=0;
+    refRectB.h=0;
+    result.x=0;
+    result.y=0;
+    result.w=0;
+    result.h=0;
+    expectedResult = result;
+    rectA = refRectA;
+    rectB = refRectB;
+    SDL_UnionRect(&rectA, &rectB, &result);
+    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_UnionRect() where rect B is inside rect A
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
+ */
+int rect_testUnionRectInside(void *arg)
+{
+    SDL_Rect refRectA, refRectB;
+    SDL_Rect rectA, rectB;
+    SDL_Rect expectedResult;
+    SDL_Rect result;
+    int dx, dy;
+    
+    /* Union 1x1 with itself */
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=1;
+    refRectA.h=1;
+    expectedResult = refRectA;
+    rectA = refRectA;
+    SDL_UnionRect(&rectA, &rectA, &result);
+    _validateUnionRectResults(&rectA, &rectA, &refRectA, &refRectA, &result, &expectedResult);
+
+    /* Union 1x1 somewhere inside */
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
+    refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
+    refRectB.x=refRectA.x + 1 + SDLTest_RandomIntegerInRange(1, refRectA.w - 2);
+    refRectB.y=refRectA.y + 1 + SDLTest_RandomIntegerInRange(1, refRectA.h - 2);
+    refRectB.w=1;
+    refRectB.h=1;
+    expectedResult = refRectA;
+    rectA = refRectA;
+    rectB = refRectB;
+    SDL_UnionRect(&rectA, &rectB, &result);
+    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+
+    /* Union inside with edges modified */
+    for (dx = -1; dx < 2; dx++) {     
+        for (dy = -1; dy < 2; dy++) {
+            if ((dx != 0) || (dy != 0)) {
+                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
+                refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
+                refRectB = refRectA;
+                if (dx == -1) refRectB.x++;
+                if ((dx == 1) || (dx == -1)) refRectB.w--;
+                if (dy == -1) refRectB.y++;
+                if ((dy == 1) || (dy == -1)) refRectB.h--;                
+                expectedResult = refRectA;
+                rectA = refRectA;
+                rectB = refRectB;
+                SDL_UnionRect(&rectA, &rectB, &result);
+                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
+            }
+        }
+    }
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_UnionRect() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
+ */
+int rect_testUnionRectParam(void *arg)
+{
+    SDL_Rect rectA, rectB;
+    SDL_Rect result;
+
+    // invalid parameter combinations
+    SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
+    SDLTest_AssertPass("Check that function returns when 1st parameter is NULL"); 
+    SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
+    SDLTest_AssertPass("Check that function returns  when 2nd parameter is NULL"); 
+    SDL_UnionRect(&rectA, &rectB, (SDL_Rect *)NULL);
+    SDLTest_AssertPass("Check that function returns  when 3rd parameter is NULL"); 
+    SDL_UnionRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
+    SDLTest_AssertPass("Check that function returns  when 1st and 3rd parameter are NULL"); 
+    SDL_UnionRect(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertPass("Check that function returns  when 2nd and 3rd parameter are NULL"); 
+    SDL_UnionRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    SDLTest_AssertPass("Check that function returns  when all parameters are NULL"); 
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_RectEmpty() with various inputs
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
+ */
+int rect_testRectEmpty(void *arg)
+{
+    SDL_Rect refRect;
+    SDL_Rect rect;
+    SDL_bool expectedResult;
+    SDL_bool result;
+    int w, h;
+
+    // Non-empty case
+    refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
+    refRect.h=SDLTest_RandomIntegerInRange(256, 1024);
+    expectedResult = SDL_FALSE;
+    rect = refRect;
+    result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
+    _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
+    
+    // Empty case
+    for (w=-1; w<2; w++) {
+        for (h=-1; h<2; h++) {
+            if ((w != 1) || (h != 1)) {
+                refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+                refRect.w=w;
+                refRect.h=h;
+                expectedResult = SDL_TRUE;
+                rect = refRect;
+                result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
+                _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
+            }
+        }
+    }
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_RectEmpty() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
+ */
+int rect_testRectEmptyParam(void *arg)
+{
+    SDL_bool result;
+
+    // invalid parameter combinations
+    result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)NULL);
+    SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL"); 
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Tests SDL_RectEquals() with various inputs
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
+ */
+int rect_testRectEquals(void *arg)
+{
+    SDL_Rect refRectA;
+    SDL_Rect refRectB;
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool expectedResult;
+    SDL_bool result;
+
+    // Equals
+    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
+    refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
+    refRectB = refRectA;    
+    expectedResult = SDL_TRUE;
+    rectA = refRectA;
+    rectB = refRectB;
+    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)&rectB);
+    _validateRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB);
+
+	return TEST_COMPLETED;
+}
+
+/*!
+ * \brief Negative tests against SDL_RectEquals() with invalid parameters
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
+ */
+int rect_testRectEqualsParam(void *arg)
+{
+    SDL_Rect rectA;
+    SDL_Rect rectB;
+    SDL_bool result;
+
+    /* data setup */
+    rectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    rectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    rectA.w=SDLTest_RandomIntegerInRange(1, 1024);
+    rectA.h=SDLTest_RandomIntegerInRange(1, 1024);
+    rectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
+    rectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
+    rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
+    rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
+
+    // invalid parameter combinations
+    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
+    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
+    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);
+    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); 
+    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)NULL);
+    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL"); 
+
+	return TEST_COMPLETED;
+}
+
+/* ================= Test References ================== */
+
+/* Rect test cases */
+
+/* SDL_IntersectRectAndLine */
+static const SDLTest_TestCaseReference rectTest1 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLine,"rect_testIntersectRectAndLine",  "Tests SDL_IntersectRectAndLine clipping cases", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest2 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_IntersectRectAndLine with line fully contained in rect", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest3 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_IntersectRectAndLine with line fully outside of rect", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest4 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_IntersectRectAndLine with empty rectangle ", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest5 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_IntersectRectAndLine with invalid parameters", TEST_ENABLED };
+
+/* SDL_IntersectRect */
+static const SDLTest_TestCaseReference rectTest6 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_IntersectRect with B fully contained in A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest7 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_IntersectRect with B fully outside of A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest8 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_IntersectRect with B partially intersecting A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest9 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_IntersectRect with 1x1 sized rectangles", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest10 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_IntersectRect with empty rectangles", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest11 =
+		{ (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_IntersectRect with invalid parameters", TEST_ENABLED };
+
+/* SDL_HasIntersection */
+static const SDLTest_TestCaseReference rectTest12 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasIntersection with B fully contained in A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest13 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasIntersection with B fully outside of A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest14 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionPartial,"rect_testHasIntersectionPartial",  "Tests SDL_HasIntersection with B partially intersecting A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest15 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasIntersection with 1x1 sized rectangles", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest16 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasIntersection with empty rectangles", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest17 =
+		{ (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasIntersection with invalid parameters", TEST_ENABLED };
+
+/* SDL_EnclosePoints */
+static const SDLTest_TestCaseReference rectTest18 =
+		{ (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_EnclosePoints without clipping", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest19 =
+		{ (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_EnclosePoints with clipping", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest20 =
+		{ (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_EnclosePoints with repeated input", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest21 =
+		{ (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_EnclosePoints with invalid parameters", TEST_ENABLED };
+
+/* SDL_UnionRect */
+static const SDLTest_TestCaseReference rectTest22 =
+		{ (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_UnionRect where rect B is inside rect A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest23 =
+		{ (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_UnionRect where rect B is outside rect A", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest24 =
+		{ (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_UnionRect where rect A or rect B are empty", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest25 =
+		{ (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_UnionRect with invalid parameters", TEST_ENABLED };
+
+/* SDL_RectEmpty */
+static const SDLTest_TestCaseReference rectTest26 =
+		{ (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest27 =
+		{ (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_RectEmpty with invalid parameters", TEST_ENABLED };
+
+/* SDL_RectEquals */
+
+static const SDLTest_TestCaseReference rectTest28 =
+		{ (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectEquals with various inputs", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rectTest29 =
+		{ (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED };
+
+
+/*!
+ * \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/CategoryRect
+ */
+static const SDLTest_TestCaseReference *rectTests[] =  {
+	&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14, 
+	&rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27,
+	&rectTest28, &rectTest29, NULL
+};
+
+
+/* Rect test suite (global) */
+SDLTest_TestSuiteReference rectTestSuite = {
+	"Rect",
+	NULL,
+	rectTests,
+	NULL
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_render.c	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,1025 @@
+/**
+ * Original code: automated SDL platform test written by Edgar Simo "bobbens"
+ * Extended and extensively updated by aschiffler at ferzkopp dot net
+ */
+
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_test.h"
+
+/* ================= Test Case Implementation ================== */
+
+#define TESTRENDER_SCREEN_W     80
+#define TESTRENDER_SCREEN_H     60
+
+#define RENDER_COMPARE_FORMAT  SDL_PIXELFORMAT_ARGB8888
+#define RENDER_COMPARE_AMASK   0xff000000 /**< Alpha bit mask. */
+#define RENDER_COMPARE_RMASK   0x00ff0000 /**< Red bit mask. */
+#define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
+#define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
+
+#define ALLOWABLE_ERROR_OPAQUE	0
+#define ALLOWABLE_ERROR_BLENDED	64
+
+SDL_Window *window = NULL;
+SDL_Renderer *renderer = NULL;
+
+/* Prototypes for helper functions */
+
+static int _clearScreen (void);
+static void _compare(const char *msg, SDL_Surface *s, int allowable_error);
+static int _hasTexAlpha(void);
+static int _hasTexColor(void);
+static SDL_Texture *_loadTestFace(void);
+static int _hasBlendModes(void);
+static int _hasDrawColor(void);
+static int _isSupported(int code);
+
+/**
+ * Create software renderer for tests
+ */
+void InitCreateRenderer(void *arg)
+{
+  int posX = 100, posY = 100, width = 320, height = 240;
+  renderer = NULL;
+  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
+  SDLTest_AssertPass("SDL_CreateWindow()");
+  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
+  if (window == NULL) {
+      return;
+  }
+  
+  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+  SDLTest_AssertPass("SDL_CreateRenderer()");
+  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
+  if (renderer == 0) {
+      SDL_DestroyWindow(window);
+      return;
+  }
+}
+
+/*
+ * Destroy renderer for tests  
+ */
+void CleanupDestroyRenderer(void *arg)
+{
+  if (renderer != NULL) {  
+     SDL_DestroyRenderer(renderer);
+     SDLTest_AssertPass("SDL_DestroyRenderer()");
+  }
+  
+  if (window != NULL) {  
+     SDL_DestroyWindow(window);
+     SDLTest_AssertPass("SDL_DestroyWindow");
+  }
+}
+
+
+/**
+ * @brief Tests call to SDL_GetNumRenderDrivers
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
+ */
+int
+render_testGetNumRenderDrivers(void *arg)
+{
+  int n;
+  n = SDL_GetNumRenderDrivers();
+  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
+  return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests the SDL primitives for rendering.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
+ *
+ */
+int render_testPrimitives (void *arg)
+{
+   int ret;
+   int x, y;
+   SDL_Rect rect;
+   int checkFailCount1;
+   int checkFailCount2;
+
+   /* Need drawcolour or just skip test. */
+   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
+
+   /* Draw a rectangle. */
+   rect.x = 40;
+   rect.y = 0;
+   rect.w = 40;
+   rect.h = 80;
+
+   ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, &rect );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   /* Draw a rectangle. */
+   rect.x = 10;
+   rect.y = 10;
+   rect.w = 60;
+   rect.h = 40;
+   ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, &rect );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   /* Draw some points like so:
+    * X.X.X.X..
+    * .X.X.X.X.
+    * X.X.X.X.. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   for (y=0; y<3; y++) {
+      for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
+         ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
+         if (ret != 0) checkFailCount1++;
+
+         ret = SDL_RenderDrawPoint(renderer, x, y );
+         if (ret != 0) checkFailCount2++;
+      }
+   }
+   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
+
+   /* Draw some lines. */
+   ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
+
+   ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
+
+   /* See if it's the same. */
+   _compare( "Primitives output not the same.", SDLTest_ImagePrimitives(), ALLOWABLE_ERROR_OPAQUE );
+
+   return TEST_COMPLETED;
+}
+
+/**
+ * @brief Tests the SDL primitives with alpha for rendering.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
+ */
+int render_testPrimitivesBlend (void *arg)
+{
+   int ret;
+   int i, j;
+   SDL_Rect rect;
+   int checkFailCount1;
+   int checkFailCount2;
+   int checkFailCount3;
+
+   /* Need drawcolour and blendmode or just skip test. */
+   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
+   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
+
+   /* Create some rectangles for each blend mode. */
+   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, NULL );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   rect.x = 10;
+   rect.y = 25;
+   rect.w = 40;
+   rect.h = 25;
+   ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, &rect );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   rect.x = 30;
+   rect.y = 40;
+   rect.w = 45;
+   rect.h = 15;
+   ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, &rect );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   rect.x = 25;
+   rect.y = 25;
+   rect.w = 25;
+   rect.h = 25;
+   ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
+
+   ret = SDL_RenderFillRect(renderer, &rect );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+
+   /* Draw blended lines, lines for everyone. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   checkFailCount3 = 0;
+   for (i=0; i<TESTRENDER_SCREEN_W; i+=2)  {
+      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
+      if (ret != 0) checkFailCount1++;
+
+      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
+            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
+      if (ret != 0) checkFailCount2++;
+
+      ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
+      if (ret != 0) checkFailCount3++;
+   }
+   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
+   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
+   
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   checkFailCount3 = 0;
+   for (i=0; i<TESTRENDER_SCREEN_H; i+=2)  {
+      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
+      if (ret != 0) checkFailCount1++;
+
+      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
+            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
+      if (ret != 0) checkFailCount2++;
+
+      ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
+      if (ret != 0) checkFailCount3++;
+   }
+   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
+   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
+
+   /* Draw points. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   checkFailCount3 = 0;
+   for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
+      for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
+         ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
+         if (ret != 0) checkFailCount1++;
+
+         ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
+               ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
+         if (ret != 0) checkFailCount2++;
+
+         ret = SDL_RenderDrawPoint(renderer, i, j );
+         if (ret != 0) checkFailCount3++;
+      }
+   }   
+   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
+   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
+
+   /* See if it's the same. */
+   _compare( "Blended primitives output not the same.", SDLTest_ImagePrimitivesBlend(), ALLOWABLE_ERROR_BLENDED );
+
+    return TEST_COMPLETED;
+}
+
+
+
+/**
+ * @brief Tests some blitting routines.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
+ * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
+ */
+int
+render_testBlit(void *arg)
+{
+   int ret;
+   SDL_Rect rect;
+   SDL_Texture *tface;
+   Uint32 tformat;
+   int taccess, tw, th;
+   int i, j, ni, nj;
+   int checkFailCount1;
+
+
+   /* Need drawcolour or just skip test. */
+   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
+
+   /* 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;
+
+   /* Loop blit. */
+   checkFailCount1 = 0;
+   for (j=0; j <= nj; j+=4) {
+      for (i=0; i <= ni; i+=4) {
+         /* Blitting. */
+         rect.x = i;
+         rect.y = j;
+         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
+         if (ret != 0) checkFailCount1++;
+      }
+   }
+   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   /* See if it's the same */
+   _compare( "Blit output not the same.", SDLTest_ImageBlit(), ALLOWABLE_ERROR_OPAQUE );
+
+   return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Blits doing colour 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;
+   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 colour mod. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   for (j=0; j <= nj; j+=4) {
+      for (i=0; i <= ni; i+=4) {
+         /* Set colour 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);
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   /* See if it's the same. */
+   _compare( "Blit output not the same (using SDL_SetTextureColorMod).",
+            SDLTest_ImageBlitColor(), ALLOWABLE_ERROR_OPAQUE );
+
+   return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests blitting with alpha.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
+ * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
+ */
+int
+render_testBlitAlpha (void *arg)
+{
+   int ret;
+   SDL_Rect rect;
+   SDL_Texture *tface;
+   Uint32 tformat;
+   int taccess, tw, th;
+   int i, j, ni, nj;
+   int checkFailCount1;
+   int checkFailCount2;
+
+
+   /* Need alpha or just skip test. */
+   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
+
+   /* 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 alpha mod. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   for (j=0; j <= nj; j+=4) {
+      for (i=0; i <= ni; i+=4) {
+         /* Set alpha mod. */
+         ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
+         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_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   /* See if it's the same. */
+   _compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
+            SDLTest_ImageBlitAlpha(), ALLOWABLE_ERROR_BLENDED );
+
+   return TEST_COMPLETED;
+}
+
+/* Helper functions */
+
+/**
+ * @brief Tests a blend mode.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
+ */
+static void
+_testBlitBlendMode( SDL_Texture * tface, int mode )
+{
+   int ret;
+   Uint32 tformat;
+   int taccess, tw, th;
+   int i, j, ni, nj;
+   SDL_Rect rect;
+   int checkFailCount1;
+   int checkFailCount2;
+
+   /* Clear surface. */
+   _clearScreen();
+
+   /* 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 blend mode. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   for (j=0; j <= nj; j+=4) {
+      for (i=0; i <= ni; i+=4) {
+         /* Set blend mode. */
+         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
+         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_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
+   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
+}
+
+
+/**
+ * @brief Tests some more blitting routines.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
+ * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
+ */
+int
+render_testBlitBlend (void *arg)
+{
+   int ret;
+   SDL_Rect rect;
+   SDL_Texture *tface;
+   Uint32 tformat;
+   int taccess, tw, th;
+   int i, j, ni, nj;
+   int mode;
+   int checkFailCount1;
+   int checkFailCount2;
+   int checkFailCount3;
+   int checkFailCount4;
+
+   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
+   SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
+   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
+
+   /* 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;
+
+   /* Set alpha mod. */
+   ret = SDL_SetTextureAlphaMod( tface, 100 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
+
+   /* Test None. */
+   _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
+   /* See if it's the same. */
+   _compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
+            SDLTest_ImageBlitBlendNone(), ALLOWABLE_ERROR_OPAQUE ); 
+
+
+   /* Test Blend. */
+   _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
+   _compare( "Blit blending output not the same (using SDL_BLENDMODE_BLEND).",
+            SDLTest_ImageBlitBlend(), ALLOWABLE_ERROR_BLENDED );
+
+
+   /* Test Add. */
+   _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
+   _compare( "Blit blending output not the same (using SDL_BLENDMODE_ADD).",
+            SDLTest_ImageBlitBlendAdd(), ALLOWABLE_ERROR_BLENDED );
+
+   /* Test Mod. */
+   _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
+   _compare( "Blit blending output not the same (using SDL_BLENDMODE_MOD).",
+            SDLTest_ImageBlitBlendMod(), ALLOWABLE_ERROR_BLENDED );
+
+   /* Clear surface. */
+   _clearScreen();
+
+   /* Loop blit. */
+   checkFailCount1 = 0;
+   checkFailCount2 = 0;
+   checkFailCount3 = 0;
+   checkFailCount4 = 0;
+   for (j=0; j <= nj; j+=4) {
+      for (i=0; i <= ni; i+=4) {
+
+         /* Set colour mod. */
+         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
+         if (ret != 0) checkFailCount1++;
+
+         /* Set alpha mod. */
+         ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
+         if (ret != 0) checkFailCount2++;
+
+         /* Crazy blending mode magic. */
+         mode = (i/4*j/4) % 4;
+         if (mode==0) mode = SDL_BLENDMODE_NONE;
+         else if (mode==1) mode = SDL_BLENDMODE_BLEND;
+         else if (mode==2) mode = SDL_BLENDMODE_ADD;
+         else if (mode==3) mode = SDL_BLENDMODE_MOD;
+         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
+         if (ret != 0) checkFailCount3++;
+
+         /* Blitting. */
+         rect.x = i;
+         rect.y = j;
+         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
+         if (ret != 0) checkFailCount4++;
+      }
+   }
+   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_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
+   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
+   SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   /* Check to see if matches. */
+   _compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
+            SDLTest_ImageBlitBlendAll(), ALLOWABLE_ERROR_BLENDED);
+
+   return TEST_COMPLETED;
+}
+
+
+
+/**
+ * @brief Checks to see if functionality is supported. Helper function.
+ */
+static int
+_isSupported( int code )
+{
+   return (code == 0);
+}
+
+/**
+ * @brief Test to see if we can vary the draw colour. Helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
+ */
+static int
+_hasDrawColor (void)
+{
+   int ret, fail;
+   Uint8 r, g, b, a;
+
+   fail = 0;
+
+   /* Set colour. */
+   ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
+   if (!_isSupported(ret))
+      fail = 1;
+   /* Restore natural. */
+   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
+   if (!_isSupported(ret))
+      fail = 1;
+
+   /* Something failed, consider not available. */
+   if (fail)
+      return 0;
+   /* Not set properly, consider failed. */
+   else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
+      return 0;
+   return 1;
+}
+
+/**
+ * @brief Test to see if we can vary the blend mode. Helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
+ */
+static int
+_hasBlendModes (void)
+{
+   int fail;
+   int ret;
+   SDL_BlendMode mode;
+
+   fail = 0;
+
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = (mode != SDL_BLENDMODE_BLEND);
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = (mode != SDL_BLENDMODE_ADD);
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = (mode != SDL_BLENDMODE_MOD);
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = (mode != SDL_BLENDMODE_NONE);
+   if (!_isSupported(ret))
+      fail = 1;
+
+   return !fail;
+}
+
+
+/**
+ * @brief Loads the test image 'Face' as texture. Helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
+ */
+static SDL_Texture *
+_loadTestFace(void)
+{
+   SDL_Surface *face;
+   SDL_Texture *tface;
+
+   face = SDLTest_ImageFace();
+   if (face == NULL) {
+      return NULL;
+   }
+   
+   tface = SDL_CreateTextureFromSurface(renderer, face);
+   if (tface == NULL) {
+       SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
+   }
+
+   SDL_FreeSurface(face);
+
+   return tface;
+}
+
+
+/**
+ * @brief Test to see if can set texture colour mode. Helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
+ * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
+ * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
+ */
+static int
+_hasTexColor (void)
+{
+   int fail;
+   int ret;
+   SDL_Texture *tface;
+   Uint8 r, g, b;
+
+   /* Get test face. */
+   tface = _loadTestFace();
+   if (tface == 0)
+      return 0;
+
+   /* See if supported. */
+   fail = 0;
+   ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
+   if (!_isSupported(ret))
+      fail = 1;
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   if (fail)
+      return 0;
+   else if ((r != 100) || (g != 100) || (b != 100))
+      return 0;
+   return 1;
+}
+
+/**
+ * @brief Test to see if we can vary the alpha of the texture. Helper function.
+ *
+ * \sa
+ *  http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
+ *  http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
+ *  http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
+ */
+static int
+_hasTexAlpha(void)
+{
+   int fail;
+   int ret;
+   SDL_Texture *tface;
+   Uint8 a;
+
+   /* Get test face. */
+   tface = _loadTestFace();
+   if (tface == 0)
+      return 0;
+
+   /* See if supported. */
+   fail = 0;
+   ret = SDL_SetTextureAlphaMod( tface, 100 );
+   if (!_isSupported(ret))
+      fail = 1;
+   ret = SDL_GetTextureAlphaMod( tface, &a );
+   if (!_isSupported(ret))
+      fail = 1;
+
+   /* Clean up. */
+   SDL_DestroyTexture( tface );
+
+   if (fail)
+      return 0;
+   else if (a != 100)
+      return 0;
+   return 1;
+}
+
+static _renderCompareCount = 0;
+
+/**
+ * @brief Compares screen pixels with image pixels. Helper function.
+ *
+ * @param msg Message on failure.
+ * @param s Image to compare against.
+ * @return 0 on success.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
+ * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
+ * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
+ */
+static void
+_compare(const char *msg, SDL_Surface *s, int allowable_error)
+{
+   int ret;
+   SDL_Rect rect;
+   Uint8 pix[4*80*60];
+   SDL_Surface *testsur;
+   char imageFilename[128];
+   char referenceFilename[128];
+
+   /* Read pixels. */
+   /* Explicitly specify the rect in case the window isn't expected size... */
+   rect.x = 0;
+   rect.y = 0;
+   rect.w = 80;
+   rect.h = 60;
+   ret = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pix, 80*4 );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", ret);
+
+   /* Create surface. */
+   testsur = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
+                                       RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
+   SDLTest_AssertCheck(testsur != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
+
+   /* Compare surface. */
+   ret = SDLTest_CompareSurfaces( testsur, s, allowable_error );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
+
+   _renderCompareCount++;
+   if (ret != 0) {
+      SDL_snprintf(imageFilename, 127, "image%i.bmp", _renderCompareCount);
+      SDL_SaveBMP(testsur, imageFilename);
+      SDL_snprintf(referenceFilename, 127, "reference%i.bmp", _renderCompareCount);
+      SDL_SaveBMP(s, referenceFilename);
+      SDLTest_LogError("Surfaces from failed comparison saved as %s and %s", imageFilename, referenceFilename);
+   }
+
+   /* Clean up. */
+   SDL_FreeSurface( testsur );
+}
+
+/**
+ * @brief Clears the screen. Helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
+ * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
+ * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
+ */
+static int
+_clearScreen(void)
+{
+   int ret;
+
+   /* Set colour. */
+   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   /* Clear screen. */
+   ret = SDL_RenderFillRect(renderer, NULL );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
+
+   /* Set defaults. */
+   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
+
+   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
+   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
+
+   return 0;
+}
+
+/* ================= Test References ================== */
+
+/* Render test cases */
+static const SDLTest_TestCaseReference renderTest1 =
+		{ (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest2 =
+		{ (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest3 =
+		{ (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest4 =
+		{ (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest5 =
+		{ (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest6 =
+		{ (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference renderTest7 =
+		{  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_ENABLED };
+
+/* Sequence of Render test cases */
+static const SDLTest_TestCaseReference *renderTests[] =  {
+	&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
+};
+
+/* Render test suite (global) */
+SDLTest_TestSuiteReference renderTestSuite = {
+	"Render",
+	InitCreateRenderer,
+	renderTests,
+	CleanupDestroyRenderer
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_rwops.c	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,427 @@
+/**
+ * Automated SDL_RWops test.
+ *
+ * Original code written by Edgar Simo "bobbens"
+ * Ported by Markus Kauppila (markus.kauppila@gmail.com)
+ * Updated for SDL_test by aschiffler at ferzkopp dot net
+ *
+ * Released under Public Domain.
+ */
+
+/* quiet windows compiler warnings */
+#define _CRT_SECURE_NO_WARNINGS
+
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_test.h"
+
+/* ================= Test Case Implementation ================== */
+
+const char* RWopsReadTestFilename = "rwops_read";
+const char* RWopsWriteTestFilename = "rwops_write";
+
+static const char RWopsHelloWorldTestString[] = "Hello World!";
+static const char RWopsHelloWorldCompString[] = "Hello World!";
+
+/* Fixture */
+
+void
+RWopsSetUp(void *arg)
+{
+	int fileLen = SDL_strlen(RWopsHelloWorldTestString);
+	FILE *handle;
+	int writtenLen;
+	int result;
+
+	/* Clean up from previous runs (if any); ignore errors */
+	remove(RWopsReadTestFilename);
+	remove(RWopsWriteTestFilename);
+
+	/* Create a test file */
+	handle = fopen(RWopsReadTestFilename, "w");
+	SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
+    if (handle == NULL) return;
+
+	/* Write some known test into it */
+	writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle);
+	SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen);
+	result = fclose(handle);
+	SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result);
+
+	SDLTest_AssertPass("Creation of test file completed");
+}
+
+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);
+
+	SDLTest_AssertPass("Cleanup of test files completed");
+}
+
+/**
+ * @brief Makes sure parameters work properly. Local helper function.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWseek
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWread
+ */
+void 
+_testGenericRWopsValidations(SDL_RWops *rw, int write)
+{
+   char buf[sizeof(RWopsHelloWorldTestString)];
+   int i;
+   int seekPos = SDLTest_RandomIntegerInRange(4, 8);
+
+   /* Clear buffer */
+   SDL_zero(buf);
+
+   /* Set to start. */
+   i = SDL_RWseek(rw, 0, RW_SEEK_SET );
+   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
+   SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
+
+   /* Test write. */
+   i = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1);
+   SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
+   if (write) {
+		SDLTest_AssertCheck(i == 1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", i);
+   }
+   else {
+		SDLTest_AssertCheck(i <= 0, "Verify result of writing with SDL_RWwrite, expected <=0, got %i", i);
+   }
+
+   /* Test seek to random position */
+   i = SDL_RWseek( rw, seekPos, RW_SEEK_SET );
+   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
+   SDLTest_AssertCheck(i == seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %i", seekPos, seekPos, i);
+
+   /* Test seek back to start */
+   i = SDL_RWseek(rw, 0, RW_SEEK_SET );
+   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
+   SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
+
+   /* Test read */
+   i = SDL_RWread( rw, buf, 1, sizeof(RWopsHelloWorldTestString)-1 );
+   SDLTest_AssertPass("Call to SDL_RWread succeeded");
+   SDLTest_AssertCheck(
+	   i == (sizeof(RWopsHelloWorldTestString)-1), 
+	   "Verify result from SDL_RWread, expected %i, got %i",
+	   sizeof(RWopsHelloWorldTestString)-1,
+	   i);
+   SDLTest_AssertCheck(
+	   SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0, 
+	   "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
+
+   /* More seek tests. */
+   i = SDL_RWseek( rw, -4, RW_SEEK_CUR );
+   SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded");
+   SDLTest_AssertCheck(
+	   i == (sizeof(RWopsHelloWorldTestString)-5), 
+	   "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i",
+	   sizeof(RWopsHelloWorldTestString)-5,
+	   i);
+
+   i = SDL_RWseek( rw, -1, RW_SEEK_END );
+   SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded");
+   SDLTest_AssertCheck(
+	   i == (sizeof(RWopsHelloWorldTestString)-2), 
+	   "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i",
+	   sizeof(RWopsHelloWorldTestString)-2,
+	   i);
+}
+
+/*!
+ * 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;
+}
+
+/**
+ * @brief Tests opening from memory.
+ *
+ * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
+ */
+int
+rwops_testMem (void)
+{
+   char mem[sizeof(RWopsHelloWorldTestString)];
+   SDL_RWops *rw;
+
+   /* Clear buffer */
+   SDL_zero(mem);
+
+   /* Open */
+   rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);
+   SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
+
+   /* Bail out if NULL */
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations(rw, 1);
+
+   /* Close */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW(rw);
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+
+   return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests opening from memory.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWFromConstMem
+ */
+int 
+rwops_testConstMem (void)
+{
+   SDL_RWops *rw;
+
+   /* Open handle */
+   rw = SDL_RWFromConstMem( RWopsHelloWorldCompString, sizeof(RWopsHelloWorldCompString)-1 );
+   SDLTest_AssertPass("Call to SDL_RWFromConstMem() succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
+
+   /* Bail out if NULL */
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations( rw, 0 );
+
+   /* Close handle */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW( rw );
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+
+  return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests reading from file.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
+ * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
+ */
+int
+rwops_testFileRead(void)
+{
+   SDL_RWops *rw;
+
+   /* Read test. */
+   rw = SDL_RWFromFile(RWopsReadTestFilename, "r");
+   SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
+
+   // Bail out if NULL
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations( rw, 0 );
+
+   /* Close handle */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW( rw );
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+
+   return TEST_COMPLETED;
+}
+
+/**
+ * @brief Tests writing from memory.
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
+ * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
+ */
+int
+rwops_testFileWrite(void)
+{
+   SDL_RWops *rw;
+
+   /* Write test. */
+   rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
+   SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
+
+   // Bail out if NULL
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations( rw, 1 );
+
+   /* Close handle */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW( rw );
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+
+   return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests reading from file handle
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
+ * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
+ *
+ */
+int
+rwops_testFPRead(void)
+{
+   FILE *fp;
+   SDL_RWops *rw;
+
+   /* Run read tests. */
+   fp = fopen(RWopsReadTestFilename, "r");
+   SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in read mode is not NULL", RWopsReadTestFilename);
+
+   /* Bail out if NULL */
+   if (fp == NULL) return TEST_ABORTED;
+
+   /* Open */
+   rw = SDL_RWFromFP( fp, 1 );
+   SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in read mode does not return NULL");
+
+   /* Bail out if NULL */
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations( rw, 0 );
+
+   /* Close handle */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW( rw );
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+   fclose(fp);
+
+   return TEST_COMPLETED;
+}
+
+
+/**
+ * @brief Tests writing to file handle
+ *
+ * \sa
+ * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
+ * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
+ *
+ */
+int
+rwops_testFPWrite(void)
+{
+   FILE *fp;
+   SDL_RWops *rw;
+
+   /* Run write tests. */
+   fp = fopen(RWopsWriteTestFilename, "w+");
+   SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in write mode is not NULL", RWopsWriteTestFilename);
+
+   /* Bail out if NULL */
+   if (fp == NULL) return TEST_ABORTED;
+
+   /* Open */
+   rw = SDL_RWFromFP( fp, 1 );
+   SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
+   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in write mode does not return NULL");
+
+   /* Bail out if NULL */
+   if (rw == NULL) return TEST_ABORTED;
+
+   /* Run generic tests */
+   _testGenericRWopsValidations( rw, 1 );
+
+   /* Close handle */
+   SDL_RWclose(rw);
+   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
+   SDL_FreeRW( rw );
+   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
+   fclose(fp);
+
+   return TEST_COMPLETED;
+}
+
+/* ================= Test References ================== */
+
+/* RWops test cases */
+static const SDLTest_TestCaseReference rwopsTest1 =
+		{ (SDLTest_TestCaseFp)rwops_testParamNegative, "rwops_testParamNegative", "Negative test for SDL_RWFromFile parameters", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest2 =
+		{ (SDLTest_TestCaseFp)rwops_testMem, "rwops_testMem", "Tests opening from memory", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest3 =
+		{ (SDLTest_TestCaseFp)rwops_testConstMem, "rwops_testConstMem", "Tests opening from (const) memory", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest4 =
+		{ (SDLTest_TestCaseFp)rwops_testFileRead, "rwops_testFileRead", "Tests reading from a file", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest5 =
+		{ (SDLTest_TestCaseFp)rwops_testFileWrite, "rwops_testFileWrite", "Test writing to a file", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest6 =
+		{ (SDLTest_TestCaseFp)rwops_testFPRead, "rwops_testFPRead", "Test reading from file pointer", TEST_ENABLED };
+
+static const SDLTest_TestCaseReference rwopsTest7 =
+		{ (SDLTest_TestCaseFp)rwops_testFPWrite, "rwops_testFPWrite", "Test writing to file pointer", TEST_ENABLED };
+
+/* Sequence of RWops test cases */
+static const SDLTest_TestCaseReference *rwopsTests[] =  {
+	&rwopsTest1, &rwopsTest2, &rwopsTest3, &rwopsTest4, &rwopsTest5, &rwopsTest6, &rwopsTest7, NULL
+};
+
+/* RWops test suite (global) */
+SDLTest_TestSuiteReference rwopsTestSuite = {
+	"RWops",
+	RWopsSetUp,
+	rwopsTests,
+	RWopsTearDown
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testautomation_suites.h	Sat Dec 22 17:24:42 2012 -0800
@@ -0,0 +1,40 @@
+/**
+ * Reference to all test suites.
+ *
+ */
+
+#ifndef _testsuites_h
+#define _testsuites_h
+
+#include "SDL_test.h"
+
+// Test collections
+//extern SDLTest_TestSuiteReference audioTestSuite;
+extern SDLTest_TestSuiteReference clipboardTestSuite;
+//extern SDLTest_TestSuiteReference eventsTestSuite;
+//extern SDLTest_TestSuiteReference keyboardTestSuite;
+extern SDLTest_TestSuiteReference platformTestSuite;
+extern SDLTest_TestSuiteReference rectTestSuite;
+extern SDLTest_TestSuiteReference renderTestSuite;
+extern SDLTest_TestSuiteReference rwopsTestSuite;
+//extern SDLTest_TestSuiteReference surfaceTestSuite;
+//extern SDLTest_TestSuiteReference syswmTestSuite;
+//extern SDLTest_TestSuiteReference videoTestSuite;
+
+// All test suites
+SDLTest_TestSuiteReference *testSuites[] =  {
+//	&audioTestSuite,
+	&clipboardTestSuite,
+//	&eventsTestSuite,
+//	&keyboardTestSuite,
+	&platformTestSuite,
+	&rectTestSuite,
+	&renderTestSuite,
+	&rwopsTestSuite,
+//	&surfaceTestSuite,
+//	&syswmTestSuite,
+//	&videoTestSuite,
+	NULL
+};
+
+#endif
--- a/test/tests/testclipboard.c	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/**
- * New/updated tests: aschiffler at ferzkopp dot net
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "SDL.h"
-#include "SDL_test.h"
-
-/* ================= Test Case Implementation ================== */
-
-/* Test case functions */
-
-/**
- * \brief Check call to SDL_HasClipboardText
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
- */
-int
-clipboard_testHasClipboardText(void *arg)
-{
-	SDL_bool result;
-	result = SDL_HasClipboardText();
-	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
-
-    return TEST_COMPLETED;
-}
-
-/**
- * \brief Check call to SDL_GetClipboardText
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
- */
-int
-clipboard_testGetClipboardText(void *arg)
-{
-	char *charResult;
-	charResult = SDL_GetClipboardText();
-	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
-
-	if (charResult) SDL_free(charResult);
-
-    return TEST_COMPLETED;
-}
-
-/**
- * \brief Check call to SDL_SetClipboardText
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
- */
-int
-clipboard_testSetClipboardText(void *arg)
-{
-	char *textRef = SDLTest_RandomAsciiString();
-	char *text = SDL_strdup(textRef);
-	int result;
-	result = SDL_SetClipboardText((const char *)text);
-	SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
-	SDLTest_AssertCheck(
-		result == 0,
-		"Validate SDL_SetClipboardText result, expected 0, got %i",
-		result);
-	SDLTest_AssertCheck(
-		SDL_strcmp(textRef, text) == 0,
-		"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
-		textRef, text);
-
-    /* Cleanup */
-    if (textRef) SDL_free(textRef);
-    if (text) SDL_free(text);
-
-   return TEST_COMPLETED;
-}
-
-/**
- * \brief End-to-end test of SDL_xyzClipboardText functions
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText
- * http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
- * http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText
- */
-int
-clipboard_testClipboardTextFunctions(void *arg)
-{
-	char *textRef = SDLTest_RandomAsciiString();
-	char *text = SDL_strdup(textRef);
-	SDL_bool boolResult;
-	int intResult;
-	char *charResult;
-
-	/* Clear clipboard text state */
-	boolResult = SDL_HasClipboardText();
-	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
-	if (boolResult == SDL_TRUE) {
-        intResult = SDL_SetClipboardText((const char *)NULL);
-		SDLTest_AssertPass("Call to DL_SetClipboardText(NULL) succeeded");
-	    SDLTest_AssertCheck(
-			intResult == 0,
-			"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
-			intResult);
-	    charResult = SDL_GetClipboardText();
-		SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
-	    boolResult = SDL_HasClipboardText();
-		SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
-	    SDLTest_AssertCheck(
-            boolResult == SDL_FALSE,
-	        "Verify SDL_HasClipboardText returned SDL_FALSE, got %s",
-			(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
-    }
-
-    /* Empty clipboard  */
-	charResult = SDL_GetClipboardText();
-	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
-	SDLTest_AssertCheck(
-		charResult != NULL,
-		"Verify SDL_GetClipboardText did not return NULL");
-	SDLTest_AssertCheck(
-		strlen(charResult) == 0,
-		"Verify SDL_GetClipboardText returned string with length 0, got length %i",
-		strlen(charResult));
-    intResult = SDL_SetClipboardText((const char *)text);
-	SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
-	SDLTest_AssertCheck(
-		intResult == 0,
-		"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
-		intResult);
-	SDLTest_AssertCheck(
-		strcmp(textRef, text) == 0,
-		"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
-		textRef, text);
-	boolResult = SDL_HasClipboardText();
-	SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded");
-	SDLTest_AssertCheck(
-        boolResult == SDL_TRUE,
-	    "Verify SDL_HasClipboardText returned SDL_TRUE, got %s",
-		(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
-	charResult = SDL_GetClipboardText();
-	SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
-	SDLTest_AssertCheck(
-		strcmp(textRef, charResult) == 0,
-		"Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'",
-		textRef, charResult);
-
-    /* Cleanup */
-    if (textRef) SDL_free(textRef);
-    if (text) SDL_free(text);
-    if (charResult) SDL_free(charResult);
-
-   return TEST_COMPLETED;
-}
-
-
-/* ================= Test References ================== */
-
-/* Clipboard test cases */
-static const SDLTest_TestCaseReference clipboardTest1 =
-		{ (SDLTest_TestCaseFp)clipboard_testHasClipboardText, "clipboard_testHasClipboardText", "Check call to SDL_HasClipboardText", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference clipboardTest2 =
-		{ (SDLTest_TestCaseFp)clipboard_testGetClipboardText, "clipboard_testGetClipboardText", "Check call to SDL_GetClipboardText", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference clipboardTest3 =
-		{ (SDLTest_TestCaseFp)clipboard_testSetClipboardText, "clipboard_testSetClipboardText", "Check call to SDL_SetClipboardText", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference clipboardTest4 =
-		{ (SDLTest_TestCaseFp)clipboard_testClipboardTextFunctions, "clipboard_testClipboardTextFunctions", "End-to-end test of SDL_xyzClipboardText functions", TEST_ENABLED };
-
-/* Sequence of Clipboard test cases */
-static const SDLTest_TestCaseReference *clipboardTests[] =  {
-	&clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, NULL
-};
-
-/* Clipboard test suite (global) */
-SDLTest_TestSuiteReference clipboardTestSuite = {
-	"Clipboard",
-	NULL,
-	clipboardTests,
-	NULL
-};
--- a/test/tests/testplatform.c	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,561 +0,0 @@
-/**
- * Original code: automated SDL platform test written by Edgar Simo "bobbens"
- * Extended and updated by aschiffler at ferzkopp dot net
- */
-
-#include <stdio.h>
-
-#include "SDL.h"
-#include "SDL_test.h"
-
-/* ================= Test Case Implementation ================== */
-
-/* Helper functions */
-
-/**
- * @brief Compare sizes of types.
- *
- * @note Watcom C flags these as Warning 201: "Unreachable code" if you just
- *  compare them directly, so we push it through a function to keep the
- *  compiler quiet.  --ryan.
- */
-static int _compareSizeOfType( size_t sizeoftype, size_t hardcodetype )
-{
-    return sizeoftype != hardcodetype;
-}
-
-/* Test case functions */
-
-/**
- * @brief Tests type sizes.
- */
-int platform_testTypes(void *arg)
-{
-   int ret;
-
-   ret = _compareSizeOfType( sizeof(Uint8), 1 );
-   SDLTest_AssertCheck( ret == 0, "sizeof(Uint8) = %lu, expected  1", sizeof(Uint8) );
-
-   ret = _compareSizeOfType( sizeof(Uint16), 2 );
-   SDLTest_AssertCheck( ret == 0, "sizeof(Uint16) = %lu, expected 2", sizeof(Uint16) );
-
-   ret = _compareSizeOfType( sizeof(Uint32), 4 );
-   SDLTest_AssertCheck( ret == 0, "sizeof(Uint32) = %lu, expected 4", sizeof(Uint32) );
-
-   ret = _compareSizeOfType( sizeof(Uint64), 8 );
-   SDLTest_AssertCheck( ret == 0, "sizeof(Uint64) = %lu, expected 8", sizeof(Uint64) );
-
-   return TEST_COMPLETED;
-}
-
-/**
- * @brief Tests platform endianness and SDL_SwapXY functions.
- */
-int platform_testEndianessAndSwap(void *arg)
-{
-    int real_byteorder;
-    Uint16 value = 0x1234;
-    Uint16 value16 = 0xCDAB;
-    Uint16 swapped16 = 0xABCD;
-    Uint32 value32 = 0xEFBEADDE;
-    Uint32 swapped32 = 0xDEADBEEF;
-
-    Uint64 value64, swapped64;
-    value64 = 0xEFBEADDE;
-    value64 <<= 32;
-    value64 |= 0xCDAB3412;
-    swapped64 = 0x1234ABCD;
-    swapped64 <<= 32;
-    swapped64 |= 0xDEADBEEF;
-
-    if ((*((char *) &value) >> 4) == 0x1) {
-        real_byteorder = SDL_BIG_ENDIAN;
-    } else {
-        real_byteorder = SDL_LIL_ENDIAN;
-    }
-
-    /* Test endianness. */
-    SDLTest_AssertCheck( real_byteorder == SDL_BYTEORDER,
-             "Machine detected as %s endian, appears to be %s endian.",
-             (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big",
-             (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" );
-
-    /* Test 16 swap. */
-    SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16,
-             "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X",
-             value16, SDL_Swap16(value16) );
-
-    /* Test 32 swap. */
-    SDLTest_AssertCheck( SDL_Swap32(value32) == swapped32,
-             "SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X",
-             value32, SDL_Swap32(value32) );
-
-    /* Test 64 swap. */
-    SDLTest_AssertCheck( SDL_Swap64(value64) == swapped64,
-#ifdef _MSC_VER
-             "SDL_Swap64(): 64 bit swapped: 0x%I64X => 0x%I64X",
-#else
-             "SDL_Swap64(): 64 bit swapped: 0x%llX => 0x%llX",
-#endif
-             value64, SDL_Swap64(value64) );
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_GetXYZ() functions
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetPlatform
- * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCount
- * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCacheLineSize
- * http://wiki.libsdl.org/moin.cgi/SDL_GetRevision
- * http://wiki.libsdl.org/moin.cgi/SDL_GetRevisionNumber
- */
-int platform_testGetFunctions (void *arg)
-{
-   char *platform;
-   char *revision;
-   int ret;
-   int len;
-
-   platform = (char *)SDL_GetPlatform();
-   SDLTest_AssertPass("SDL_GetPlatform()");
-   SDLTest_AssertCheck(platform != NULL, "SDL_GetPlatform() != NULL");
-   if (platform != NULL) {
-     len = strlen(platform);
-     SDLTest_AssertCheck(len > 0,
-             "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i",
-             platform,
-             len);
-   }
-
-   ret = SDL_GetCPUCount();
-   SDLTest_AssertPass("SDL_GetCPUCount()");
-   SDLTest_AssertCheck(ret > 0,
-             "SDL_GetCPUCount(): expected count > 0, was: %i",
-             ret);
-
-   ret = SDL_GetCPUCacheLineSize();
-   SDLTest_AssertPass("SDL_GetCPUCacheLineSize()");
-   SDLTest_AssertCheck(ret >= 0,
-             "SDL_GetCPUCacheLineSize(): expected size >= 0, was: %i",
-             ret);
-
-   revision = (char *)SDL_GetRevision();
-   SDLTest_AssertPass("SDL_GetRevision()");
-   SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
-
-   ret = SDL_GetRevisionNumber();
-   SDLTest_AssertPass("SDL_GetRevisionNumber()");
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasXYZ() functions
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_Has3DNow
- * http://wiki.libsdl.org/moin.cgi/SDL_HasAltiVec
- * http://wiki.libsdl.org/moin.cgi/SDL_HasMMX
- * http://wiki.libsdl.org/moin.cgi/SDL_HasRDTSC
- * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE
- * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE2
- * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE3
- * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE41
- * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE42
- */
-int platform_testHasFunctions (void *arg)
-{
-   int ret;
-
-   // TODO: independently determine and compare values as well
-
-   ret = SDL_HasRDTSC();
-   SDLTest_AssertPass("SDL_HasRDTSC()");
-
-   ret = SDL_HasAltiVec();
-   SDLTest_AssertPass("SDL_HasAltiVec()");
-
-   ret = SDL_HasMMX();
-   SDLTest_AssertPass("SDL_HasMMX()");
-
-   ret = SDL_Has3DNow();
-   SDLTest_AssertPass("SDL_Has3DNow()");
-
-   ret = SDL_HasSSE();
-   SDLTest_AssertPass("SDL_HasSSE()");
-
-   ret = SDL_HasSSE2();
-   SDLTest_AssertPass("SDL_HasSSE2()");
-
-   ret = SDL_HasSSE3();
-   SDLTest_AssertPass("SDL_HasSSE3()");
-
-   ret = SDL_HasSSE41();
-   SDLTest_AssertPass("SDL_HasSSE41()");
-
-   ret = SDL_HasSSE42();
-   SDLTest_AssertPass("SDL_HasSSE42()");
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_GetVersion
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetVersion
- */
-int platform_testGetVersion(void *arg)
-{
-   SDL_version linked;
-   int major = SDL_MAJOR_VERSION;
-   int minor = SDL_MINOR_VERSION;
-
-   SDL_GetVersion(&linked);
-   SDLTest_AssertCheck( linked.major >= major,
-             "SDL_GetVersion(): returned major %i (>= %i)",
-             linked.major,
-             major);
-   SDLTest_AssertCheck( linked.minor >= minor,
-             "SDL_GetVersion(): returned minor %i (>= %i)",
-             linked.minor,
-             minor);
-
-   return TEST_COMPLETED;
-}
-
-
-/*!
- * \brief Tests SDL_VERSION macro
- */
-int platform_testSDLVersion(void *arg)
-{
-   SDL_version compiled;
-   int major = SDL_MAJOR_VERSION;
-   int minor = SDL_MINOR_VERSION;
-
-   SDL_VERSION(&compiled);
-   SDLTest_AssertCheck( compiled.major >= major,
-             "SDL_VERSION() returned major %i (>= %i)",
-             compiled.major,
-             major);
-   SDLTest_AssertCheck( compiled.minor >= minor,
-             "SDL_VERSION() returned minor %i (>= %i)",
-             compiled.minor,
-             minor);
-
-   return TEST_COMPLETED;
-}
-
-
-/*!
- * \brief Tests default SDL_Init
- */
-int platform_testDefaultInit(void *arg)
-{
-   int ret;
-   int subsystem;
-
-   subsystem = SDL_WasInit(SDL_INIT_EVERYTHING);
-   SDLTest_AssertCheck( subsystem != 0,
-             "SDL_WasInit(0): returned %i, expected != 0",
-             subsystem);
-
-   ret = SDL_Init(SDL_WasInit(SDL_INIT_EVERYTHING));
-   SDLTest_AssertCheck( ret == 0,
-             "SDL_Init(0): returned %i, expected 0, error: %s",
-             ret,
-             SDL_GetError());
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_Get/Set/ClearError
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetError
- * http://wiki.libsdl.org/moin.cgi/SDL_SetError
- * http://wiki.libsdl.org/moin.cgi/SDL_ClearError
- */
-int platform_testGetSetClearError(void *arg)
-{
-   const char *testError = "Testing";
-   char *lastError;
-   int len;
-
-   SDL_ClearError();
-   SDLTest_AssertPass("SDL_ClearError()");
-
-   lastError = (char *)SDL_GetError();
-   SDLTest_AssertPass("SDL_GetError()");
-   SDLTest_AssertCheck(lastError != NULL,
-             "SDL_GetError() != NULL");
-   if (lastError != NULL)
-   {
-     len = strlen(lastError);
-     SDLTest_AssertCheck(len == 0,
-             "SDL_GetError(): no message expected, len: %i", len);
-   }
-
-   SDL_SetError("%s", testError);
-   SDLTest_AssertPass("SDL_SetError()");
-   lastError = (char *)SDL_GetError();
-   SDLTest_AssertCheck(lastError != NULL,
-             "SDL_GetError() != NULL");
-   if (lastError != NULL)
-   {
-     len = strlen(lastError);
-     SDLTest_AssertCheck(len == strlen(testError),
-             "SDL_GetError(): expected message len %i, was len: %i",
-             strlen(testError),
-             len);
-     SDLTest_AssertCheck(strcmp(lastError, testError) == 0,
-             "SDL_GetError(): expected message %s, was message: %s",
-             testError,
-             lastError);
-   }
-
-   // Clean up
-   SDL_ClearError();
-   SDLTest_AssertPass("SDL_ClearError()");
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_SetError with empty input
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetError
- */
-int platform_testSetErrorEmptyInput(void *arg)
-{
-   const char *testError = "";
-   char *lastError;
-   int len;
-
-   SDL_SetError("%s", testError);
-   SDLTest_AssertPass("SDL_SetError()");
-   lastError = (char *)SDL_GetError();
-   SDLTest_AssertCheck(lastError != NULL,
-             "SDL_GetError() != NULL");
-   if (lastError != NULL)
-   {
-     len = strlen(lastError);
-     SDLTest_AssertCheck(len == strlen(testError),
-             "SDL_GetError(): expected message len %i, was len: %i",
-             strlen(testError),
-             len);
-     SDLTest_AssertCheck(strcmp(lastError, testError) == 0,
-             "SDL_GetError(): expected message '%s', was message: '%s'",
-             testError,
-             lastError);
-   }
-
-   // Clean up
-   SDL_ClearError();
-   SDLTest_AssertPass("SDL_ClearError()");
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_SetError with invalid input
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetError
- */
-int platform_testSetErrorInvalidInput(void *arg)
-{
-   const char *testError = NULL;
-   const char *probeError = "Testing";
-   char *lastError;
-   int len;
-
-   // Reset
-   SDL_ClearError();
-   SDLTest_AssertPass("SDL_ClearError()");
-
-   // Check for no-op
-   SDL_SetError(testError);
-   SDLTest_AssertPass("SDL_SetError()");
-   lastError = (char *)SDL_GetError();
-   SDLTest_AssertCheck(lastError != NULL,
-             "SDL_GetError() != NULL");
-   if (lastError != NULL)
-   {
-     len = strlen(lastError);
-     SDLTest_AssertCheck(len == 0,
-             "SDL_GetError(): expected message len 0, was len: %i",
-             0,
-             len);
-     SDLTest_AssertCheck(strcmp(lastError, "") == 0,
-             "SDL_GetError(): expected message '', was message: '%s'",
-             lastError);
-   }
-
-   // Set
-   SDL_SetError(probeError);
-   SDLTest_AssertPass("SDL_SetError()");
-
-   // Check for no-op
-   SDL_SetError(testError);
-   SDLTest_AssertPass("SDL_SetError()");
-   lastError = (char *)SDL_GetError();
-   SDLTest_AssertCheck(lastError != NULL,
-             "SDL_GetError() != NULL");
-   if (lastError != NULL)
-   {
-     len = strlen(lastError);
-     SDLTest_AssertCheck(len == strlen(probeError),
-             "SDL_GetError(): expected message len %i, was len: %i",
-             strlen(probeError),
-             len);
-     SDLTest_AssertCheck(strcmp(lastError, probeError) == 0,
-             "SDL_GetError(): expected message '%s', was message: '%s'",
-             probeError,
-             lastError);
-   }
-
-   // Clean up
-   SDL_ClearError();
-   SDLTest_AssertPass("SDL_ClearError()");
-
-   return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_GetPowerInfo
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetPowerInfo
- */
-int platform_testGetPowerInfo(void *arg)
-{
-   SDL_PowerState state;
-   SDL_PowerState stateAgain;
-   int secs;
-   int secsAgain;
-   int pct;
-   int pctAgain;
-
-   state = SDL_GetPowerInfo(&secs, &pct);
-   SDLTest_AssertPass("SDL_GetPowerInfo()");
-   SDLTest_AssertCheck(
-       state==SDL_POWERSTATE_UNKNOWN ||
-       state==SDL_POWERSTATE_ON_BATTERY ||
-       state==SDL_POWERSTATE_NO_BATTERY ||
-       state==SDL_POWERSTATE_CHARGING ||
-       state==SDL_POWERSTATE_CHARGED,
-       "SDL_GetPowerInfo(): state %i is one of the expected values",
-       (int)state);
-
-   if (state==SDL_POWERSTATE_ON_BATTERY)
-   {
-      SDLTest_AssertCheck(
-         secs >= 0,
-         "SDL_GetPowerInfo(): on battery, secs >= 0, was: %i",
-         secs);
-      SDLTest_AssertCheck(
-         (pct >= 0) && (pct <= 100),
-         "SDL_GetPowerInfo(): on battery, pct=[0,100], was: %i",
-         pct);
-   }
-
-   if (state==SDL_POWERSTATE_UNKNOWN ||
-       state==SDL_POWERSTATE_NO_BATTERY)
-   {
-      SDLTest_AssertCheck(
-         secs == -1,
-         "SDL_GetPowerInfo(): no battery, secs == -1, was: %i",
-         secs);
-      SDLTest_AssertCheck(
-         pct == -1,
-         "SDL_GetPowerInfo(): no battery, pct == -1, was: %i",
-         pct);
-   }
-
-   // Partial return value variations
-   stateAgain = SDL_GetPowerInfo(&secsAgain, NULL);
-   SDLTest_AssertCheck(
-        state==stateAgain,
-        "State %i returned when only 'secs' requested",
-        stateAgain);
-   SDLTest_AssertCheck(
-        secs==secsAgain,
-        "Value %i matches when only 'secs' requested",
-        secsAgain);
-   stateAgain = SDL_GetPowerInfo(NULL, &pctAgain);
-   SDLTest_AssertCheck(
-        state==stateAgain,
-        "State %i returned when only 'pct' requested",
-        stateAgain);
-   SDLTest_AssertCheck(
-        pct==pctAgain,
-        "Value %i matches when only 'pct' requested",
-        pctAgain);
-   stateAgain = SDL_GetPowerInfo(NULL, NULL);
-   SDLTest_AssertCheck(
-        state==stateAgain,
-        "State %i returned when no value requested",
-        stateAgain);
-
-   return TEST_COMPLETED;
-}
-
-/* ================= Test References ================== */
-
-/* Platform test cases */
-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 endianess and swap functions", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest3 =
-		{ (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest4 =
-		{ (SDLTest_TestCaseFp)platform_testHasFunctions, "platform_testHasFunctions", "Tests various SDL_HasXYZ functions", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest5 =
-		{ (SDLTest_TestCaseFp)platform_testGetVersion, "platform_testGetVersion", "Tests SDL_GetVersion function", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest6 =
-		{ (SDLTest_TestCaseFp)platform_testSDLVersion, "platform_testSDLVersion", "Tests SDL_VERSION macro", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest7 =
-		{ (SDLTest_TestCaseFp)platform_testDefaultInit, "platform_testDefaultInit", "Tests default SDL_Init", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest8 =
-		{ (SDLTest_TestCaseFp)platform_testGetSetClearError, "platform_testGetSetClearError", "Tests SDL_Get/Set/ClearError", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest9 =
-		{ (SDLTest_TestCaseFp)platform_testSetErrorEmptyInput, "platform_testSetErrorEmptyInput", "Tests SDL_SetError with empty input", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest10 =
-		{ (SDLTest_TestCaseFp)platform_testSetErrorInvalidInput, "platform_testSetErrorInvalidInput", "Tests SDL_SetError with invalid input", TEST_ENABLED};
-
-static const SDLTest_TestCaseReference platformTest11 =
-		{ (SDLTest_TestCaseFp)platform_testGetPowerInfo, "platform_testGetPowerInfo", "Tests SDL_GetPowerInfo function", TEST_ENABLED };
-
-/* Sequence of Platform test cases */
-static const SDLTest_TestCaseReference *platformTests[] =  {
-	&platformTest1,
-	&platformTest2,
-	&platformTest3,
-	&platformTest4,
-	&platformTest5,
-	&platformTest6,
-	&platformTest7,
-	&platformTest8,
-	&platformTest9,
-	&platformTest10,
-	&platformTest11,
-	NULL
-};
-
-/* Platform test suite (global) */
-SDLTest_TestSuiteReference platformTestSuite = {
-	"Platform",
-	NULL,
-	platformTests,
-	NULL
-};
--- a/test/tests/testrect.c	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1677 +0,0 @@
-/**
- * Original code: automated SDL rect test written by Edgar Simo "bobbens"
- * New/updated tests: aschiffler at ferzkopp dot net
- */
-
-#include <stdio.h>
-
-#include "SDL.h"
-#include "SDL_test.h"
-
-/* ================= Test Case Implementation ================== */
-
-/* Helper functions */
-
-/*!
- * \brief Private helper to check SDL_IntersectRectAndLine results
- */
-void _validateIntersectRectAndLineResults(
-    SDL_bool intersection, SDL_bool expectedIntersection,
-    SDL_Rect *rect, SDL_Rect * refRect,
-    int x1, int y1, int x2, int y2,
-    int x1Ref, int y1Ref, int x2Ref, int y2Ref)
-{
-    SDLTest_AssertCheck(intersection == expectedIntersection, 
-        "Check for correct intersection result: expected %s, got %s intersecting rect (%d,%d,%d,%d) with line (%d,%d - %d,%d)",
-        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        refRect->x, refRect->y, refRect->w, refRect->h,
-        x1Ref, y1Ref, x2Ref, y2Ref);
-    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
-        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rect->x, rect->y, rect->w, rect->h,
-        refRect->x, refRect->y, refRect->w, refRect->h);
-    SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
-        "Check if line was incorrectly clipped or modified: got (%d,%d - %d,%d) expected (%d,%d - %d,%d)",
-        x1, y1, x2, y2,
-        x1Ref, y1Ref, x2Ref, y2Ref);
-}
-
-/* Test case functions */
-
-/*!
- * \brief Tests SDL_IntersectRectAndLine() clipping cases
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
- */
-int 
-rect_testIntersectRectAndLine (void *arg)
-{
-    SDL_Rect refRect = { 0, 0, 32, 32 };
-    SDL_Rect rect;
-    int x1, y1;
-    int x2, y2;
-    SDL_bool intersected;
-
-    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
-    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
-    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
-    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
-
-    x1 = xLeft;
-    y1 = 15;
-    x2 = xRight;
-    y2 = 15;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15);
-
-    x1 = 15;
-    y1 = yTop;
-    x2 = 15;
-    y2 = yBottom;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31);
-
-    x1 = -refRect.w;
-    y1 = -refRect.h;
-    x2 = 2*refRect.w;
-    y2 = 2*refRect.h;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-     _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31);
-
-    x1 = 2*refRect.w;
-    y1 = 2*refRect.h;
-    x2 = -refRect.w;
-    y2 = -refRect.h;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0);
-
-    x1 = -1;
-    y1 = 32;
-    x2 = 32;
-    y2 = -1;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0);
-
-    x1 = 32;
-    y1 = -1;
-    x2 = -1;
-    y2 = 32;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
- */
-int 
-rect_testIntersectRectAndLineInside (void *arg)
-{
-    SDL_Rect refRect = { 0, 0, 32, 32 };
-    SDL_Rect rect;
-    int x1, y1;
-    int x2, y2;
-    SDL_bool intersected;
-
-    int xmin = refRect.x;
-    int xmax = refRect.x + refRect.w - 1;
-    int ymin = refRect.y;
-    int ymax = refRect.y + refRect.h - 1;
-    int x1Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
-    int y1Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
-    int x2Ref = SDLTest_RandomIntegerInRange(xmin + 1, xmax - 1);
-    int y2Ref = SDLTest_RandomIntegerInRange(ymin + 1, ymax - 1);
-
-    x1 = x1Ref;
-    y1 = y1Ref;
-    x2 = x2Ref;
-    y2 = y2Ref;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
-
-    x1 = x1Ref;
-    y1 = y1Ref;
-    x2 = xmax;
-    y2 = ymax;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax);
-
-    x1 = xmin;
-    y1 = ymin;
-    x2 = x2Ref;
-    y2 = y2Ref;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref);
-
-    x1 = xmin;
-    y1 = ymin;
-    x2 = xmax;
-    y2 = ymax;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax);
-
-    x1 = xmin;
-    y1 = ymax;
-    x2 = xmax;
-    y2 = ymin;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
- */
-int 
-rect_testIntersectRectAndLineOutside (void *arg)
-{
-    SDL_Rect refRect = { 0, 0, 32, 32 };
-    SDL_Rect rect;
-    int x1, y1;
-    int x2, y2;
-    SDL_bool intersected;
-
-    int xLeft = -SDLTest_RandomIntegerInRange(1, refRect.w);
-    int xRight = refRect.w + SDLTest_RandomIntegerInRange(1, refRect.w);
-    int yTop = -SDLTest_RandomIntegerInRange(1, refRect.h);
-    int yBottom = refRect.h + SDLTest_RandomIntegerInRange(1, refRect.h);
-
-    x1 = xLeft;
-    y1 = 0;
-    x2 = xLeft;
-    y2 = 31;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31);
-
-    x1 = xRight;
-    y1 = 0;
-    x2 = xRight;
-    y2 = 31;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31);
-
-    x1 = 0;
-    y1 = yTop;
-    x2 = 31;
-    y2 = yTop;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop);
-
-    x1 = 0;
-    y1 = yBottom;
-    x2 = 31;
-    y2 = yBottom;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRectAndLine() with empty rectangle
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
- */
-int 
-rect_testIntersectRectAndLineEmpty (void *arg)
-{
-    SDL_Rect refRect;
-    SDL_Rect rect;
-    int x1, y1, x1Ref, y1Ref;
-    int x2, y2, x2Ref, y2Ref;
-    SDL_bool intersected;
-        
-    refRect.x = SDLTest_RandomIntegerInRange(1, 1024);
-    refRect.y = SDLTest_RandomIntegerInRange(1, 1024);
-    refRect.w = 0;
-    refRect.h = 0;
-    x1Ref = refRect.x;
-    y1Ref = refRect.y;
-    x2Ref = SDLTest_RandomIntegerInRange(1, 1024);
-    y2Ref = SDLTest_RandomIntegerInRange(1, 1024);
-
-    x1 = x1Ref;
-    y1 = y1Ref;
-    x2 = x2Ref;
-    y2 = y2Ref;
-    rect = refRect;
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRectAndLine
- */
-int 
-rect_testIntersectRectAndLineParam (void *arg)
-{
-    SDL_Rect rect = { 0, 0, 32, 32 };
-    int x1 = rect.w / 2;
-    int y1 = rect.h / 2;
-    int x2 = x1;
-    int y2 = 2 * rect.h;
-    SDL_bool intersected;
-    
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2);
-    SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE");
-    
-    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
-    intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL");
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL");
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL");
-    intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL");
-    intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL);
-    SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Private helper to check SDL_HasIntersection results
- */
-void _validateHasIntersectionResults(
-    SDL_bool intersection, SDL_bool expectedIntersection, 
-    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
-{
-    SDLTest_AssertCheck(intersection == expectedIntersection, 
-        "Check intersection result: expected %s, got %s intersecting A (%d,%d,%d,%d) with B (%d,%d,%d,%d)",
-        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        rectA->x, rectA->y, rectA->w, rectA->h, 
-        rectB->x, rectB->y, rectB->w, rectB->h);
-    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
-        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectA->x, rectA->y, rectA->w, rectA->h,
-        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
-    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
-        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectB->x, rectB->y, rectB->w, rectB->h,
-        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
-}
-
-/*!
- * \brief Private helper to check SDL_IntersectRect results
- */
-void _validateIntersectRectResults(
-    SDL_bool intersection, SDL_bool expectedIntersection, 
-    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
-    SDL_Rect *result, SDL_Rect *expectedResult)
-{
-    _validateHasIntersectionResults(intersection, expectedIntersection, rectA, rectB, refRectA, refRectB);
-    if (result && expectedResult) {
-        SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
-            "Check that intersection of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-            rectA->x, rectA->y, rectA->w, rectA->h, 
-            rectB->x, rectB->y, rectB->w, rectB->h,
-            result->x, result->y, result->w, result->h,
-            expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
-    }
-}
-
-/*!
- * \brief Private helper to check SDL_UnionRect results
- */
-void _validateUnionRectResults(
-    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, 
-    SDL_Rect *result, SDL_Rect *expectedResult)
-{
-    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
-        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectA->x, rectA->y, rectA->w, rectA->h,
-        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
-    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
-        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectB->x, rectB->y, rectB->w, rectB->h,
-        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
-    SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
-        "Check that union of rectangles A (%d,%d,%d,%d) and B (%d,%d,%d,%d) was correctly calculated, got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectA->x, rectA->y, rectA->w, rectA->h, 
-        rectB->x, rectB->y, rectB->w, rectB->h,
-        result->x, result->y, result->w, result->h,
-        expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
-}
-
-/*!
- * \brief Private helper to check SDL_RectEmpty results
- */
-void _validateRectEmptyResults(
-    SDL_bool empty, SDL_bool expectedEmpty, 
-    SDL_Rect *rect, SDL_Rect *refRect)
-{
-    SDLTest_AssertCheck(empty == expectedEmpty, 
-        "Check for correct empty result: expected %s, got %s testing (%d,%d,%d,%d)",
-        (expectedEmpty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        rect->x, rect->y, rect->w, rect->h);
-    SDLTest_AssertCheck(rect->x == refRect->x && rect->y == refRect->y && rect->w == refRect->w && rect->h == refRect->h,
-        "Check that source rectangle was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rect->x, rect->y, rect->w, rect->h,
-        refRect->x, refRect->y, refRect->w, refRect->h);
-}
-
-/*!
- * \brief Private helper to check SDL_RectEquals results
- */
-void _validateRectEqualsResults(
-    SDL_bool equals, SDL_bool expectedEquals, 
-    SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB)
-{
-    SDLTest_AssertCheck(equals == expectedEquals, 
-        "Check for correct equals result: expected %s, got %s testing (%d,%d,%d,%d) and (%d,%d,%d,%d)",
-        (expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        (equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
-        rectA->x, rectA->y, rectA->w, rectA->h,
-        rectB->x, rectB->y, rectB->w, rectB->h);
-    SDLTest_AssertCheck(rectA->x == refRectA->x && rectA->y == refRectA->y && rectA->w == refRectA->w && rectA->h == refRectA->h,
-        "Check that source rectangle A was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectA->x, rectA->y, rectA->w, rectA->h,
-        refRectA->x, refRectA->y, refRectA->w, refRectA->h);
-    SDLTest_AssertCheck(rectB->x == refRectB->x && rectB->y == refRectB->y && rectB->w == refRectB->w && rectB->h == refRectB->h,
-        "Check that source rectangle B was not modified: got (%d,%d,%d,%d) expected (%d,%d,%d,%d)",
-        rectB->x, rectB->y, rectB->w, rectB->h,
-        refRectB->x, refRectB->y, refRectB->w, refRectB->h);
-}
-
-/*!
- * \brief Tests SDL_IntersectRect() with B fully inside A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectInside (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_bool intersection;
-
-    // rectB fully contained in rectA
-    refRectB.x = 0;
-    refRectB.y = 0;
-    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRect() with B fully outside A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectOutside (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_bool intersection;
-
-    // rectB fully outside of rectA
-    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
-    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
-    refRectB.w = refRectA.w;
-    refRectB.h = refRectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);    
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRect() with B partially intersecting A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectPartial (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_Rect expectedResult;
-    SDL_bool intersection;
-
-    // rectB partially contained in rectA
-    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
-    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
-    refRectB.w = refRectA.w;
-    refRectB.h = refRectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    expectedResult.x = refRectB.x;
-    expectedResult.y = refRectB.y;
-    expectedResult.w = refRectA.w - refRectB.x;
-    expectedResult.h = refRectA.h - refRectB.y;    
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    // rectB right edge
-    refRectB.x = rectA.w - 1;
-    refRectB.y = rectA.y;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    expectedResult.x = refRectB.x;
-    expectedResult.y = refRectB.y;
-    expectedResult.w = 1;
-    expectedResult.h = refRectB.h;    
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    // rectB left edge
-    refRectB.x = 1 - rectA.w;
-    refRectB.y = rectA.y;
-    refRectB.w = refRectA.w;
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    expectedResult.x = 0;
-    expectedResult.y = refRectB.y;
-    expectedResult.w = 1;
-    expectedResult.h = refRectB.h;    
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    // rectB bottom edge
-    refRectB.x = rectA.x;
-    refRectB.y = rectA.h - 1;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    expectedResult.x = refRectB.x;
-    expectedResult.y = refRectB.y;
-    expectedResult.w = refRectB.w;
-    expectedResult.h = 1;    
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    // rectB top edge
-    refRectB.x = rectA.x;
-    refRectB.y = 1 - rectA.h;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = rectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    expectedResult.x = refRectB.x;
-    expectedResult.y = 0;
-    expectedResult.w = refRectB.w;
-    expectedResult.h = 1;    
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectPoint (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 1, 1 };
-    SDL_Rect refRectB = { 0, 0, 1, 1 };
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_bool intersection;
-    int offsetX, offsetY;
-
-    // intersecting pixels
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB.x = refRectA.x;
-    refRectB.y = refRectA.y;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
-
-    // non-intersecting pixels cases
-    for (offsetX = -1; offsetX <= 1; offsetX++) {
-        for (offsetY = -1; offsetY <= 1; offsetY++) {
-            if (offsetX != 0 || offsetY != 0) {
-                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-                refRectB.x = refRectA.x;
-                refRectB.y = refRectA.y;    
-                refRectB.x += offsetX;
-                refRectB.y += offsetY;
-                rectA = refRectA;
-                rectB = refRectB;
-                intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-                _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-            }
-        }
-    }
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_IntersectRect() with empty rectangles
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectEmpty (void *arg)
-{
-    SDL_Rect refRectA;
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_bool intersection;
-
-    // Rect A empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectA.w = 0;
-    refRectA.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-
-    // Rect B empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectB.w = 0;
-    refRectB.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-
-    // Rect A and B empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectA.w = 0;
-    refRectA.h = 0;
-    refRectB.w = 0;
-    refRectB.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_IntersectRect(&rectA, &rectB, &result);
-    _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_IntersectRect() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_IntersectRect
- */
-int rect_testIntersectRectParam(void *arg)
-{
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_Rect result;
-    SDL_bool intersection;
-
-    // invalid parameter combinations
-    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
-    intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
-    intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL"); 
-    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL"); 
-    intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL "); 
-    intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasIntersection() with B fully inside A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionInside (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-
-    // rectB fully contained in rectA
-    refRectB.x = 0;
-    refRectB.y = 0;
-    refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasIntersection() with B fully outside A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionOutside (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-
-    // rectB fully outside of rectA
-    refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
-    refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
-    refRectB.w = refRectA.w;
-    refRectB.h = refRectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasIntersection() with B partially intersecting A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionPartial (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 32, 32 };
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-
-    // rectB partially contained in rectA
-    refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
-    refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
-    refRectB.w = refRectA.w;
-    refRectB.h = refRectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // rectB right edge
-    refRectB.x = rectA.w - 1;
-    refRectB.y = rectA.y;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // rectB left edge
-    refRectB.x = 1 - rectA.w;
-    refRectB.y = rectA.y;
-    refRectB.w = refRectA.w;
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // rectB bottom edge
-    refRectB.x = rectA.x;
-    refRectB.y = rectA.h - 1;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1);
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // rectB top edge
-    refRectB.x = rectA.x;
-    refRectB.y = 1 - rectA.h;
-    refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
-    refRectB.h = rectA.h;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionPoint (void *arg)
-{
-    SDL_Rect refRectA = { 0, 0, 1, 1 };
-    SDL_Rect refRectB = { 0, 0, 1, 1 };
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-    int offsetX, offsetY;
-
-    // intersecting pixels
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB.x = refRectA.x;
-    refRectB.y = refRectA.y;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // non-intersecting pixels cases
-    for (offsetX = -1; offsetX <= 1; offsetX++) {
-        for (offsetY = -1; offsetY <= 1; offsetY++) {
-            if (offsetX != 0 || offsetY != 0) {
-                refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-                refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-                refRectB.x = refRectA.x;
-                refRectB.y = refRectA.y;    
-                refRectB.x += offsetX;
-                refRectB.y += offsetY;
-                rectA = refRectA;
-                rectB = refRectB;
-                intersection = SDL_HasIntersection(&rectA, &rectB);
-                _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
-            }
-        }
-    }
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_HasIntersection() with empty rectangles
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionEmpty (void *arg)
-{
-    SDL_Rect refRectA;
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-
-    // Rect A empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectA.w = 0;
-    refRectA.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // Rect B empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectB.w = 0;
-    refRectB.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
-
-    // Rect A and B empty
-    refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
-    refRectA.h = SDLTest_RandomIntegerInRange(1, 100);
-    refRectB = refRectA;
-    refRectA.w = 0;
-    refRectA.h = 0;
-    refRectB.w = 0;
-    refRectB.h = 0;
-    rectA = refRectA;
-    rectB = refRectB;
-    intersection = SDL_HasIntersection(&rectA, &rectB);
-    _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_HasIntersection() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection
- */
-int rect_testHasIntersectionParam(void *arg)
-{
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool intersection;
-
-    // invalid parameter combinations
-    intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
-    intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); 
-    intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL");     
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Test SDL_EnclosePoints() without clipping
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
- */
-int rect_testEnclosePoints(void *arg)
-{
-    const int numPoints = 16;
-    SDL_Point refPoints[16];
-    SDL_Point points[16];
-    SDL_Rect result;
-    SDL_bool anyEnclosed;
-    SDL_bool anyEnclosedNoResult;
-
-    // Create input data, tracking result
-    SDL_bool expectedEnclosed = SDL_TRUE;
-    int newx, newy;
-    int minx, maxx, miny, maxy;
-    int i;
-    for (i=0; i<numPoints; i++) {
-        newx = SDLTest_RandomIntegerInRange(-1024, 1024);
-        newy = SDLTest_RandomIntegerInRange(-1024, 1024);
-        refPoints[i].x = newx;
-        refPoints[i].y = newy;
-        points[i].x = newx;
-        points[i].y = newy;
-        if (i==0) {
-            minx=maxx=newx;
-            miny=maxy=newy;
-        } else {
-            if (newx<minx) minx=newx;
-            if (newx>maxx) maxx=newx;
-            if (newy<miny) miny=newy;
-            if (newy>maxy) maxy=newy;
-        }
-    }
-    
-    // Call function and validate - special case: no result requested
-    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
-        "Check expected return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-
-    // Call function and validate
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
-        "Check return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-    SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
-        "Resulting enclosing rectangle incorrect: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
-        minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Test SDL_EnclosePoints() with repeated input points
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
- */
-int rect_testEnclosePointsRepeatedInput(void *arg)
-{
-    const int numPoints = 8;
-    const int halfPoints = 4;
-    SDL_Point refPoints[8];
-    SDL_Point points[8];
-    SDL_Rect result;
-    SDL_bool anyEnclosed;
-    SDL_bool anyEnclosedNoResult;
-
-    // Create input data, tracking result
-    SDL_bool expectedEnclosed = SDL_TRUE;
-    int newx, newy;
-    int minx, maxx, miny, maxy;
-    int i;
-    for (i=0; i<numPoints; i++) {
-        if (i < halfPoints) {
-            newx = SDLTest_RandomIntegerInRange(-1024, 1024);
-            newy = SDLTest_RandomIntegerInRange(-1024, 1024);
-        } else {
-            newx = refPoints[i-halfPoints].x;
-            newy = refPoints[i-halfPoints].y;
-        }
-        refPoints[i].x = newx;
-        refPoints[i].y = newy;
-        points[i].x = newx;
-        points[i].y = newy;
-        if (i==0) {
-            minx=maxx=newx;
-            miny=maxy=newy;
-        } else {
-            if (newx<minx) minx=newx;
-            if (newx>maxx) maxx=newx;
-            if (newy<miny) miny=newy;
-            if (newy>maxy) maxy=newy;
-        }
-    }
-
-    // Call function and validate - special case: no result requested
-    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
-        "Check return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-    
-    // Call function and validate
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
-        "Check return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-    SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
-        "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
-        minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Test SDL_EnclosePoints() with clipping
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
- */
-int rect_testEnclosePointsWithClipping(void *arg)
-{
-    const int numPoints = 16;
-    SDL_Point refPoints[16];
-    SDL_Point points[16];
-    SDL_Rect refClip;
-    SDL_Rect clip;
-    SDL_Rect result;
-    SDL_bool anyEnclosed;
-    SDL_bool anyEnclosedNoResult;
-    SDL_bool expectedEnclosed = SDL_FALSE;
-    int newx, newy;
-    int minx, maxx, miny, maxy;
-    int i;
-
-    // Setup clipping rectangle
-    refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
-    refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
-    refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
-    refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
-
-    // Create input data, tracking result
-    for (i=0; i<numPoints; i++) {
-        newx = SDLTest_RandomIntegerInRange(-1024, 1024);
-        newy = SDLTest_RandomIntegerInRange(-1024, 1024);
-        refPoints[i].x = newx;
-        refPoints[i].y = newy;
-        points[i].x = newx;
-        points[i].y = newy;
-        if ((newx>=refClip.x) && (newx<(refClip.x + refClip.w)) &&
-            (newy>=refClip.y) && (newy<(refClip.y + refClip.h))) {
-            if (expectedEnclosed==SDL_FALSE) {
-                minx=maxx=newx;
-                miny=maxy=newy;
-            } else {
-                if (newx<minx) minx=newx;
-                if (newx>maxx) maxx=newx;
-                if (newy<miny) miny=newy;
-                if (newy>maxy) maxy=newy;
-            }
-            expectedEnclosed = SDL_TRUE;
-        }
-    }
-
-    // Call function and validate - special case: no result requested
-    clip = refClip;
-    anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult, 
-        "Expected return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosedNoResult==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-    SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
-        "Check that source clipping rectangle was not modified");
-    
-    // Call function and validate
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
-        "Check return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
-    for (i=0; i<numPoints; i++) {
-        SDLTest_AssertCheck(refPoints[i].x==points[i].x && refPoints[i].y==points[i].y,
-            "Check that source point %i was not modified: expected (%i,%i) actual (%i,%i)", 
-            i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
-    }
-    SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
-        "Check that source clipping rectangle was not modified");
-    if (expectedEnclosed==SDL_TRUE) {
-        SDLTest_AssertCheck(result.x==minx && result.y==miny && result.w==(maxx - minx + 1) && result.h==(maxy - miny + 1),
-            "Check resulting enclosing rectangle: expected (%i,%i - %i,%i), actual (%i,%i - %i,%i)",
-            minx, miny, maxx, maxy, result.x, result.y, result.x + result.w - 1, result.y + result.h - 1);
-    }    
-    
-    /* Empty clipping rectangle */
-    clip.w = 0;
-    clip.h = 0;
-    expectedEnclosed = SDL_FALSE;
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(expectedEnclosed==anyEnclosed, 
-        "Check return value %s, got %s", 
-        (expectedEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", 
-		(anyEnclosed==SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");    
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_EnclosePoints() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_EnclosePoints
- */
-int rect_testEnclosePointsParam(void *arg)
-{
-    SDL_Point points[1];
-    int count;
-    SDL_Rect clip;
-    SDL_Rect result;
-    SDL_bool anyEnclosed;
-
-    // invalid parameter combinations
-    anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL"); 
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is 0");
-    count = SDLTest_RandomIntegerInRange(-100, -1);
-    anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is %i (negative)", count); 
-    anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result);
-    SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL and 2nd parameter was 0"); 
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_UnionRect() where rect B is outside rect A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
- */
-int rect_testUnionRectOutside(void *arg)
-{
-    SDL_Rect refRectA, refRectB;
-    SDL_Rect rectA, rectB;
-    SDL_Rect expectedResult;
-    SDL_Rect result;
-    int minx, maxx, miny, maxy;
-    int dx, dy;
-    
-    /* Union 1x1 outside */
-    for (dx = -1; dx < 2; dx++) {     
-        for (dy = -1; dy < 2; dy++) {
-            if ((dx != 0) || (dy != 0)) {
-                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.w=1;
-                refRectA.h=1;
-                refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
-                refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024) + dx*2048;
-                refRectB.w=1;
-                refRectB.h=1;
-                minx = (refRectA.x<refRectB.x) ? refRectA.x : refRectB.x;
-                maxx = (refRectA.x>refRectB.x) ? refRectA.x : refRectB.x;
-                miny = (refRectA.y<refRectB.y) ? refRectA.y : refRectB.y;
-                maxy = (refRectA.y>refRectB.y) ? refRectA.y : refRectB.y;                
-                expectedResult.x = minx;
-                expectedResult.y = miny;
-                expectedResult.w = maxx - minx + 1;
-                expectedResult.h = maxy - miny + 1;
-                rectA = refRectA;
-                rectB = refRectB;
-                SDL_UnionRect(&rectA, &rectB, &result);
-                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-            }
-        }
-    }
-
-    /* Union outside overlap */
-    for (dx = -1; dx < 2; dx++) {     
-        for (dy = -1; dy < 2; dy++) {
-            if ((dx != 0) || (dy != 0)) {
-                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.w=SDLTest_RandomIntegerInRange(256, 512);
-                refRectA.h=SDLTest_RandomIntegerInRange(256, 512);
-                refRectB.x=refRectA.x + 1 + dx*2;
-                refRectB.y=refRectA.y + 1 + dy*2;
-                refRectB.w=refRectA.w - 2;
-                refRectB.h=refRectA.h - 2;
-                expectedResult = refRectA;
-                if (dx == -1) expectedResult.x--;
-                if (dy == -1) expectedResult.y--;
-                if ((dx == 1) || (dx == -1)) expectedResult.w++;
-                if ((dy == 1) || (dy == -1)) expectedResult.h++;
-                rectA = refRectA;
-                rectB = refRectB;
-                SDL_UnionRect(&rectA, &rectB, &result);
-                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-            }
-        }
-    }
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_UnionRect() where rect A or rect B are empty
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
- */
-int rect_testUnionRectEmpty(void *arg)
-{
-    SDL_Rect refRectA, refRectB;
-    SDL_Rect rectA, rectB;
-    SDL_Rect expectedResult;
-    SDL_Rect result;
-
-    /* A empty */    
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=0;
-    refRectA.h=0;
-    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.w=SDLTest_RandomIntegerInRange(1, 1024);
-    refRectB.h=SDLTest_RandomIntegerInRange(1, 1024);
-    expectedResult = refRectB;
-    rectA = refRectA;
-    rectB = refRectB;
-    SDL_UnionRect(&rectA, &rectB, &result);
-    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-    
-    /* B empty */    
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
-    refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
-    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.w=0;
-    refRectB.h=0;
-    expectedResult = refRectA;
-    rectA = refRectA;
-    rectB = refRectB;
-    SDL_UnionRect(&rectA, &rectB, &result);
-    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    /* A and B empty */    
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=0;
-    refRectA.h=0;
-    refRectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectB.w=0;
-    refRectB.h=0;
-    result.x=0;
-    result.y=0;
-    result.w=0;
-    result.h=0;
-    expectedResult = result;
-    rectA = refRectA;
-    rectB = refRectB;
-    SDL_UnionRect(&rectA, &rectB, &result);
-    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_UnionRect() where rect B is inside rect A
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
- */
-int rect_testUnionRectInside(void *arg)
-{
-    SDL_Rect refRectA, refRectB;
-    SDL_Rect rectA, rectB;
-    SDL_Rect expectedResult;
-    SDL_Rect result;
-    int dx, dy;
-    
-    /* Union 1x1 with itself */
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=1;
-    refRectA.h=1;
-    expectedResult = refRectA;
-    rectA = refRectA;
-    SDL_UnionRect(&rectA, &rectA, &result);
-    _validateUnionRectResults(&rectA, &rectA, &refRectA, &refRectA, &result, &expectedResult);
-
-    /* Union 1x1 somewhere inside */
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
-    refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
-    refRectB.x=refRectA.x + 1 + SDLTest_RandomIntegerInRange(1, refRectA.w - 2);
-    refRectB.y=refRectA.y + 1 + SDLTest_RandomIntegerInRange(1, refRectA.h - 2);
-    refRectB.w=1;
-    refRectB.h=1;
-    expectedResult = refRectA;
-    rectA = refRectA;
-    rectB = refRectB;
-    SDL_UnionRect(&rectA, &rectB, &result);
-    _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-
-    /* Union inside with edges modified */
-    for (dx = -1; dx < 2; dx++) {     
-        for (dy = -1; dy < 2; dy++) {
-            if ((dx != 0) || (dy != 0)) {
-                refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRectA.w=SDLTest_RandomIntegerInRange(256, 1024);
-                refRectA.h=SDLTest_RandomIntegerInRange(256, 1024);
-                refRectB = refRectA;
-                if (dx == -1) refRectB.x++;
-                if ((dx == 1) || (dx == -1)) refRectB.w--;
-                if (dy == -1) refRectB.y++;
-                if ((dy == 1) || (dy == -1)) refRectB.h--;                
-                expectedResult = refRectA;
-                rectA = refRectA;
-                rectB = refRectB;
-                SDL_UnionRect(&rectA, &rectB, &result);
-                _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
-            }
-        }
-    }
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_UnionRect() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_UnionRect
- */
-int rect_testUnionRectParam(void *arg)
-{
-    SDL_Rect rectA, rectB;
-    SDL_Rect result;
-
-    // invalid parameter combinations
-    SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
-    SDLTest_AssertPass("Check that function returns when 1st parameter is NULL"); 
-    SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
-    SDLTest_AssertPass("Check that function returns  when 2nd parameter is NULL"); 
-    SDL_UnionRect(&rectA, &rectB, (SDL_Rect *)NULL);
-    SDLTest_AssertPass("Check that function returns  when 3rd parameter is NULL"); 
-    SDL_UnionRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL);
-    SDLTest_AssertPass("Check that function returns  when 1st and 3rd parameter are NULL"); 
-    SDL_UnionRect(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertPass("Check that function returns  when 2nd and 3rd parameter are NULL"); 
-    SDL_UnionRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-    SDLTest_AssertPass("Check that function returns  when all parameters are NULL"); 
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_RectEmpty() with various inputs
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
- */
-int rect_testRectEmpty(void *arg)
-{
-    SDL_Rect refRect;
-    SDL_Rect rect;
-    SDL_bool expectedResult;
-    SDL_bool result;
-    int w, h;
-
-    // Non-empty case
-    refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
-    refRect.h=SDLTest_RandomIntegerInRange(256, 1024);
-    expectedResult = SDL_FALSE;
-    rect = refRect;
-    result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
-    _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
-    
-    // Empty case
-    for (w=-1; w<2; w++) {
-        for (h=-1; h<2; h++) {
-            if ((w != 1) || (h != 1)) {
-                refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-                refRect.w=w;
-                refRect.h=h;
-                expectedResult = SDL_TRUE;
-                rect = refRect;
-                result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
-                _validateRectEmptyResults(result, expectedResult, &rect, &refRect);
-            }
-        }
-    }
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_RectEmpty() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RectEmpty
- */
-int rect_testRectEmptyParam(void *arg)
-{
-    SDL_bool result;
-
-    // invalid parameter combinations
-    result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)NULL);
-    SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL"); 
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Tests SDL_RectEquals() with various inputs
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
- */
-int rect_testRectEquals(void *arg)
-{
-    SDL_Rect refRectA;
-    SDL_Rect refRectB;
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool expectedResult;
-    SDL_bool result;
-
-    // Equals
-    refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
-    refRectA.h=SDLTest_RandomIntegerInRange(1, 1024);
-    refRectB = refRectA;    
-    expectedResult = SDL_TRUE;
-    rectA = refRectA;
-    rectB = refRectB;
-    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)&rectB);
-    _validateRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB);
-
-	return TEST_COMPLETED;
-}
-
-/*!
- * \brief Negative tests against SDL_RectEquals() with invalid parameters
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RectEquals
- */
-int rect_testRectEqualsParam(void *arg)
-{
-    SDL_Rect rectA;
-    SDL_Rect rectB;
-    SDL_bool result;
-
-    /* data setup */
-    rectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    rectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    rectA.w=SDLTest_RandomIntegerInRange(1, 1024);
-    rectA.h=SDLTest_RandomIntegerInRange(1, 1024);
-    rectB.x=SDLTest_RandomIntegerInRange(-1024, 1024);
-    rectB.y=SDLTest_RandomIntegerInRange(-1024, 1024);
-    rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
-    rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
-
-    // invalid parameter combinations
-    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
-    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); 
-    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);
-    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); 
-    result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)NULL);
-    SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL"); 
-
-	return TEST_COMPLETED;
-}
-
-/* ================= Test References ================== */
-
-/* Rect test cases */
-
-/* SDL_IntersectRectAndLine */
-static const SDLTest_TestCaseReference rectTest1 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLine,"rect_testIntersectRectAndLine",  "Tests SDL_IntersectRectAndLine clipping cases", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest2 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_IntersectRectAndLine with line fully contained in rect", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest3 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_IntersectRectAndLine with line fully outside of rect", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest4 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_IntersectRectAndLine with empty rectangle ", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest5 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_IntersectRectAndLine with invalid parameters", TEST_ENABLED };
-
-/* SDL_IntersectRect */
-static const SDLTest_TestCaseReference rectTest6 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_IntersectRect with B fully contained in A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest7 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_IntersectRect with B fully outside of A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest8 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_IntersectRect with B partially intersecting A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest9 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_IntersectRect with 1x1 sized rectangles", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest10 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_IntersectRect with empty rectangles", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest11 =
-		{ (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_IntersectRect with invalid parameters", TEST_ENABLED };
-
-/* SDL_HasIntersection */
-static const SDLTest_TestCaseReference rectTest12 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasIntersection with B fully contained in A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest13 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasIntersection with B fully outside of A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest14 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionPartial,"rect_testHasIntersectionPartial",  "Tests SDL_HasIntersection with B partially intersecting A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest15 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasIntersection with 1x1 sized rectangles", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest16 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasIntersection with empty rectangles", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest17 =
-		{ (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasIntersection with invalid parameters", TEST_ENABLED };
-
-/* SDL_EnclosePoints */
-static const SDLTest_TestCaseReference rectTest18 =
-		{ (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_EnclosePoints without clipping", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest19 =
-		{ (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_EnclosePoints with clipping", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest20 =
-		{ (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_EnclosePoints with repeated input", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest21 =
-		{ (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_EnclosePoints with invalid parameters", TEST_ENABLED };
-
-/* SDL_UnionRect */
-static const SDLTest_TestCaseReference rectTest22 =
-		{ (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_UnionRect where rect B is inside rect A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest23 =
-		{ (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_UnionRect where rect B is outside rect A", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest24 =
-		{ (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_UnionRect where rect A or rect B are empty", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest25 =
-		{ (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_UnionRect with invalid parameters", TEST_ENABLED };
-
-/* SDL_RectEmpty */
-static const SDLTest_TestCaseReference rectTest26 =
-		{ (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest27 =
-		{ (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_RectEmpty with invalid parameters", TEST_ENABLED };
-
-/* SDL_RectEquals */
-
-static const SDLTest_TestCaseReference rectTest28 =
-		{ (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectEquals with various inputs", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rectTest29 =
-		{ (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED };
-
-
-/*!
- * \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/CategoryRect
- */
-static const SDLTest_TestCaseReference *rectTests[] =  {
-	&rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14, 
-	&rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27,
-	&rectTest28, &rectTest29, NULL
-};
-
-
-/* Rect test suite (global) */
-SDLTest_TestSuiteReference rectTestSuite = {
-	"Rect",
-	NULL,
-	rectTests,
-	NULL
-};
--- a/test/tests/testrender.c	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1025 +0,0 @@
-/**
- * Original code: automated SDL platform test written by Edgar Simo "bobbens"
- * Extended and extensively updated by aschiffler at ferzkopp dot net
- */
-
-#include <stdio.h>
-
-#include "SDL.h"
-#include "SDL_test.h"
-
-/* ================= Test Case Implementation ================== */
-
-#define TESTRENDER_SCREEN_W     80
-#define TESTRENDER_SCREEN_H     60
-
-#define RENDER_COMPARE_FORMAT  SDL_PIXELFORMAT_ARGB8888
-#define RENDER_COMPARE_AMASK   0xff000000 /**< Alpha bit mask. */
-#define RENDER_COMPARE_RMASK   0x00ff0000 /**< Red bit mask. */
-#define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
-#define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
-
-#define ALLOWABLE_ERROR_OPAQUE	0
-#define ALLOWABLE_ERROR_BLENDED	64
-
-SDL_Window *window = NULL;
-SDL_Renderer *renderer = NULL;
-
-/* Prototypes for helper functions */
-
-static int _clearScreen (void);
-static void _compare(const char *msg, SDL_Surface *s, int allowable_error);
-static int _hasTexAlpha(void);
-static int _hasTexColor(void);
-static SDL_Texture *_loadTestFace(void);
-static int _hasBlendModes(void);
-static int _hasDrawColor(void);
-static int _isSupported(int code);
-
-/**
- * Create software renderer for tests
- */
-void InitCreateRenderer(void *arg)
-{
-  int posX = 100, posY = 100, width = 320, height = 240;
-  renderer = NULL;
-  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
-  SDLTest_AssertPass("SDL_CreateWindow()");
-  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
-  if (window == NULL) {
-      return;
-  }
-  
-  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
-  SDLTest_AssertPass("SDL_CreateRenderer()");
-  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
-  if (renderer == 0) {
-      SDL_DestroyWindow(window);
-      return;
-  }
-}
-
-/*
- * Destroy renderer for tests  
- */
-void CleanupDestroyRenderer(void *arg)
-{
-  if (renderer != NULL) {  
-     SDL_DestroyRenderer(renderer);
-     SDLTest_AssertPass("SDL_DestroyRenderer()");
-  }
-  
-  if (window != NULL) {  
-     SDL_DestroyWindow(window);
-     SDLTest_AssertPass("SDL_DestroyWindow");
-  }
-}
-
-
-/**
- * @brief Tests call to SDL_GetNumRenderDrivers
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
- */
-int
-render_testGetNumRenderDrivers(void *arg)
-{
-  int n;
-  n = SDL_GetNumRenderDrivers();
-  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
-  return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests the SDL primitives for rendering.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
- *
- */
-int render_testPrimitives (void *arg)
-{
-   int ret;
-   int x, y;
-   SDL_Rect rect;
-   int checkFailCount1;
-   int checkFailCount2;
-
-   /* Need drawcolour or just skip test. */
-   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
-
-   /* Draw a rectangle. */
-   rect.x = 40;
-   rect.y = 0;
-   rect.w = 40;
-   rect.h = 80;
-
-   ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, &rect );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   /* Draw a rectangle. */
-   rect.x = 10;
-   rect.y = 10;
-   rect.w = 60;
-   rect.h = 40;
-   ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, &rect );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   /* Draw some points like so:
-    * X.X.X.X..
-    * .X.X.X.X.
-    * X.X.X.X.. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   for (y=0; y<3; y++) {
-      for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
-         ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
-         if (ret != 0) checkFailCount1++;
-
-         ret = SDL_RenderDrawPoint(renderer, x, y );
-         if (ret != 0) checkFailCount2++;
-      }
-   }
-   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
-
-   /* Draw some lines. */
-   ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
-
-   ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
-   /* See if it's the same. */
-   _compare( "Primitives output not the same.", SDLTest_ImagePrimitives(), ALLOWABLE_ERROR_OPAQUE );
-
-   return TEST_COMPLETED;
-}
-
-/**
- * @brief Tests the SDL primitives with alpha for rendering.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
- */
-int render_testPrimitivesBlend (void *arg)
-{
-   int ret;
-   int i, j;
-   SDL_Rect rect;
-   int checkFailCount1;
-   int checkFailCount2;
-   int checkFailCount3;
-
-   /* Need drawcolour and blendmode or just skip test. */
-   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
-   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
-
-   /* Create some rectangles for each blend mode. */
-   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, NULL );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   rect.x = 10;
-   rect.y = 25;
-   rect.w = 40;
-   rect.h = 25;
-   ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, &rect );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   rect.x = 30;
-   rect.y = 40;
-   rect.w = 45;
-   rect.h = 15;
-   ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, &rect );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   rect.x = 25;
-   rect.y = 25;
-   rect.w = 25;
-   rect.h = 25;
-   ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
-
-   ret = SDL_RenderFillRect(renderer, &rect );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-
-   /* Draw blended lines, lines for everyone. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   checkFailCount3 = 0;
-   for (i=0; i<TESTRENDER_SCREEN_W; i+=2)  {
-      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
-      if (ret != 0) checkFailCount1++;
-
-      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
-            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
-      if (ret != 0) checkFailCount2++;
-
-      ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
-      if (ret != 0) checkFailCount3++;
-   }
-   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
-   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
-   
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   checkFailCount3 = 0;
-   for (i=0; i<TESTRENDER_SCREEN_H; i+=2)  {
-      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
-      if (ret != 0) checkFailCount1++;
-
-      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
-            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
-      if (ret != 0) checkFailCount2++;
-
-      ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
-      if (ret != 0) checkFailCount3++;
-   }
-   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
-   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
-
-   /* Draw points. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   checkFailCount3 = 0;
-   for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
-      for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
-         ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
-         if (ret != 0) checkFailCount1++;
-
-         ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
-               ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
-         if (ret != 0) checkFailCount2++;
-
-         ret = SDL_RenderDrawPoint(renderer, i, j );
-         if (ret != 0) checkFailCount3++;
-      }
-   }   
-   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
-   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
-
-   /* See if it's the same. */
-   _compare( "Blended primitives output not the same.", SDLTest_ImagePrimitivesBlend(), ALLOWABLE_ERROR_BLENDED );
-
-    return TEST_COMPLETED;
-}
-
-
-
-/**
- * @brief Tests some blitting routines.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
- * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
- */
-int
-render_testBlit(void *arg)
-{
-   int ret;
-   SDL_Rect rect;
-   SDL_Texture *tface;
-   Uint32 tformat;
-   int taccess, tw, th;
-   int i, j, ni, nj;
-   int checkFailCount1;
-
-
-   /* Need drawcolour or just skip test. */
-   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
-
-   /* 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;
-
-   /* Loop blit. */
-   checkFailCount1 = 0;
-   for (j=0; j <= nj; j+=4) {
-      for (i=0; i <= ni; i+=4) {
-         /* Blitting. */
-         rect.x = i;
-         rect.y = j;
-         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
-         if (ret != 0) checkFailCount1++;
-      }
-   }
-   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   /* See if it's the same */
-   _compare( "Blit output not the same.", SDLTest_ImageBlit(), ALLOWABLE_ERROR_OPAQUE );
-
-   return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Blits doing colour 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;
-   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 colour mod. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   for (j=0; j <= nj; j+=4) {
-      for (i=0; i <= ni; i+=4) {
-         /* Set colour 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);
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   /* See if it's the same. */
-   _compare( "Blit output not the same (using SDL_SetTextureColorMod).",
-            SDLTest_ImageBlitColor(), ALLOWABLE_ERROR_OPAQUE );
-
-   return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests blitting with alpha.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
- * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
- */
-int
-render_testBlitAlpha (void *arg)
-{
-   int ret;
-   SDL_Rect rect;
-   SDL_Texture *tface;
-   Uint32 tformat;
-   int taccess, tw, th;
-   int i, j, ni, nj;
-   int checkFailCount1;
-   int checkFailCount2;
-
-
-   /* Need alpha or just skip test. */
-   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
-
-   /* 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 alpha mod. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   for (j=0; j <= nj; j+=4) {
-      for (i=0; i <= ni; i+=4) {
-         /* Set alpha mod. */
-         ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
-         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_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   /* See if it's the same. */
-   _compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
-            SDLTest_ImageBlitAlpha(), ALLOWABLE_ERROR_BLENDED );
-
-   return TEST_COMPLETED;
-}
-
-/* Helper functions */
-
-/**
- * @brief Tests a blend mode.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
- */
-static void
-_testBlitBlendMode( SDL_Texture * tface, int mode )
-{
-   int ret;
-   Uint32 tformat;
-   int taccess, tw, th;
-   int i, j, ni, nj;
-   SDL_Rect rect;
-   int checkFailCount1;
-   int checkFailCount2;
-
-   /* Clear surface. */
-   _clearScreen();
-
-   /* 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 blend mode. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   for (j=0; j <= nj; j+=4) {
-      for (i=0; i <= ni; i+=4) {
-         /* Set blend mode. */
-         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
-         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_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
-   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
-}
-
-
-/**
- * @brief Tests some more blitting routines.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
- * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
- */
-int
-render_testBlitBlend (void *arg)
-{
-   int ret;
-   SDL_Rect rect;
-   SDL_Texture *tface;
-   Uint32 tformat;
-   int taccess, tw, th;
-   int i, j, ni, nj;
-   int mode;
-   int checkFailCount1;
-   int checkFailCount2;
-   int checkFailCount3;
-   int checkFailCount4;
-
-   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
-   SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
-   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
-
-   /* 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;
-
-   /* Set alpha mod. */
-   ret = SDL_SetTextureAlphaMod( tface, 100 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
-
-   /* Test None. */
-   _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
-   /* See if it's the same. */
-   _compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
-            SDLTest_ImageBlitBlendNone(), ALLOWABLE_ERROR_OPAQUE ); 
-
-
-   /* Test Blend. */
-   _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
-   _compare( "Blit blending output not the same (using SDL_BLENDMODE_BLEND).",
-            SDLTest_ImageBlitBlend(), ALLOWABLE_ERROR_BLENDED );
-
-
-   /* Test Add. */
-   _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
-   _compare( "Blit blending output not the same (using SDL_BLENDMODE_ADD).",
-            SDLTest_ImageBlitBlendAdd(), ALLOWABLE_ERROR_BLENDED );
-
-   /* Test Mod. */
-   _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
-   _compare( "Blit blending output not the same (using SDL_BLENDMODE_MOD).",
-            SDLTest_ImageBlitBlendMod(), ALLOWABLE_ERROR_BLENDED );
-
-   /* Clear surface. */
-   _clearScreen();
-
-   /* Loop blit. */
-   checkFailCount1 = 0;
-   checkFailCount2 = 0;
-   checkFailCount3 = 0;
-   checkFailCount4 = 0;
-   for (j=0; j <= nj; j+=4) {
-      for (i=0; i <= ni; i+=4) {
-
-         /* Set colour mod. */
-         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
-         if (ret != 0) checkFailCount1++;
-
-         /* Set alpha mod. */
-         ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
-         if (ret != 0) checkFailCount2++;
-
-         /* Crazy blending mode magic. */
-         mode = (i/4*j/4) % 4;
-         if (mode==0) mode = SDL_BLENDMODE_NONE;
-         else if (mode==1) mode = SDL_BLENDMODE_BLEND;
-         else if (mode==2) mode = SDL_BLENDMODE_ADD;
-         else if (mode==3) mode = SDL_BLENDMODE_MOD;
-         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
-         if (ret != 0) checkFailCount3++;
-
-         /* Blitting. */
-         rect.x = i;
-         rect.y = j;
-         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
-         if (ret != 0) checkFailCount4++;
-      }
-   }
-   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_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
-   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
-   SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   /* Check to see if matches. */
-   _compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
-            SDLTest_ImageBlitBlendAll(), ALLOWABLE_ERROR_BLENDED);
-
-   return TEST_COMPLETED;
-}
-
-
-
-/**
- * @brief Checks to see if functionality is supported. Helper function.
- */
-static int
-_isSupported( int code )
-{
-   return (code == 0);
-}
-
-/**
- * @brief Test to see if we can vary the draw colour. Helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
- * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
- */
-static int
-_hasDrawColor (void)
-{
-   int ret, fail;
-   Uint8 r, g, b, a;
-
-   fail = 0;
-
-   /* Set colour. */
-   ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
-   if (!_isSupported(ret))
-      fail = 1;
-   /* Restore natural. */
-   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
-   if (!_isSupported(ret))
-      fail = 1;
-
-   /* Something failed, consider not available. */
-   if (fail)
-      return 0;
-   /* Not set properly, consider failed. */
-   else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
-      return 0;
-   return 1;
-}
-
-/**
- * @brief Test to see if we can vary the blend mode. Helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
- * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
- */
-static int
-_hasBlendModes (void)
-{
-   int fail;
-   int ret;
-   SDL_BlendMode mode;
-
-   fail = 0;
-
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = (mode != SDL_BLENDMODE_BLEND);
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = (mode != SDL_BLENDMODE_ADD);
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = (mode != SDL_BLENDMODE_MOD);
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = (mode != SDL_BLENDMODE_NONE);
-   if (!_isSupported(ret))
-      fail = 1;
-
-   return !fail;
-}
-
-
-/**
- * @brief Loads the test image 'Face' as texture. Helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
- */
-static SDL_Texture *
-_loadTestFace(void)
-{
-   SDL_Surface *face;
-   SDL_Texture *tface;
-
-   face = SDLTest_ImageFace();
-   if (face == NULL) {
-      return NULL;
-   }
-   
-   tface = SDL_CreateTextureFromSurface(renderer, face);
-   if (tface == NULL) {
-       SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
-   }
-
-   SDL_FreeSurface(face);
-
-   return tface;
-}
-
-
-/**
- * @brief Test to see if can set texture colour mode. Helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
- * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
- * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
- */
-static int
-_hasTexColor (void)
-{
-   int fail;
-   int ret;
-   SDL_Texture *tface;
-   Uint8 r, g, b;
-
-   /* Get test face. */
-   tface = _loadTestFace();
-   if (tface == 0)
-      return 0;
-
-   /* See if supported. */
-   fail = 0;
-   ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
-   if (!_isSupported(ret))
-      fail = 1;
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   if (fail)
-      return 0;
-   else if ((r != 100) || (g != 100) || (b != 100))
-      return 0;
-   return 1;
-}
-
-/**
- * @brief Test to see if we can vary the alpha of the texture. Helper function.
- *
- * \sa
- *  http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
- *  http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
- *  http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
- */
-static int
-_hasTexAlpha(void)
-{
-   int fail;
-   int ret;
-   SDL_Texture *tface;
-   Uint8 a;
-
-   /* Get test face. */
-   tface = _loadTestFace();
-   if (tface == 0)
-      return 0;
-
-   /* See if supported. */
-   fail = 0;
-   ret = SDL_SetTextureAlphaMod( tface, 100 );
-   if (!_isSupported(ret))
-      fail = 1;
-   ret = SDL_GetTextureAlphaMod( tface, &a );
-   if (!_isSupported(ret))
-      fail = 1;
-
-   /* Clean up. */
-   SDL_DestroyTexture( tface );
-
-   if (fail)
-      return 0;
-   else if (a != 100)
-      return 0;
-   return 1;
-}
-
-static _renderCompareCount = 0;
-
-/**
- * @brief Compares screen pixels with image pixels. Helper function.
- *
- * @param msg Message on failure.
- * @param s Image to compare against.
- * @return 0 on success.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
- * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
- * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
- */
-static void
-_compare(const char *msg, SDL_Surface *s, int allowable_error)
-{
-   int ret;
-   SDL_Rect rect;
-   Uint8 pix[4*80*60];
-   SDL_Surface *testsur;
-   char imageFilename[128];
-   char referenceFilename[128];
-
-   /* Read pixels. */
-   /* Explicitly specify the rect in case the window isn't expected size... */
-   rect.x = 0;
-   rect.y = 0;
-   rect.w = 80;
-   rect.h = 60;
-   ret = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pix, 80*4 );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", ret);
-
-   /* Create surface. */
-   testsur = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
-                                       RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
-   SDLTest_AssertCheck(testsur != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
-
-   /* Compare surface. */
-   ret = SDLTest_CompareSurfaces( testsur, s, allowable_error );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
-
-   _renderCompareCount++;
-   if (ret != 0) {
-      SDL_snprintf(imageFilename, 127, "image%i.bmp", _renderCompareCount);
-      SDL_SaveBMP(testsur, imageFilename);
-      SDL_snprintf(referenceFilename, 127, "reference%i.bmp", _renderCompareCount);
-      SDL_SaveBMP(s, referenceFilename);
-      SDLTest_LogError("Surfaces from failed comparison saved as %s and %s", imageFilename, referenceFilename);
-   }
-
-   /* Clean up. */
-   SDL_FreeSurface( testsur );
-}
-
-/**
- * @brief Clears the screen. Helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
- * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
- * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
- */
-static int
-_clearScreen(void)
-{
-   int ret;
-
-   /* Set colour. */
-   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   /* Clear screen. */
-   ret = SDL_RenderFillRect(renderer, NULL );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
-
-   /* Set defaults. */
-   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
-
-   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
-   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
-
-   return 0;
-}
-
-/* ================= Test References ================== */
-
-/* Render test cases */
-static const SDLTest_TestCaseReference renderTest1 =
-		{ (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest2 =
-		{ (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest3 =
-		{ (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest4 =
-		{ (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest5 =
-		{ (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest6 =
-		{ (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference renderTest7 =
-		{  (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_ENABLED };
-
-/* Sequence of Render test cases */
-static const SDLTest_TestCaseReference *renderTests[] =  {
-	&renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
-};
-
-/* Render test suite (global) */
-SDLTest_TestSuiteReference renderTestSuite = {
-	"Render",
-	InitCreateRenderer,
-	renderTests,
-	CleanupDestroyRenderer
-};
--- a/test/tests/testrwops.c	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-/**
- * Automated SDL_RWops test.
- *
- * Original code written by Edgar Simo "bobbens"
- * Ported by Markus Kauppila (markus.kauppila@gmail.com)
- * Updated for SDL_test by aschiffler at ferzkopp dot net
- *
- * Released under Public Domain.
- */
-
-/* quiet windows compiler warnings */
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <stdio.h>
-
-#include "SDL.h"
-#include "SDL_test.h"
-
-/* ================= Test Case Implementation ================== */
-
-const char* RWopsReadTestFilename = "rwops_read";
-const char* RWopsWriteTestFilename = "rwops_write";
-
-static const char RWopsHelloWorldTestString[] = "Hello World!";
-static const char RWopsHelloWorldCompString[] = "Hello World!";
-
-/* Fixture */
-
-void
-RWopsSetUp(void *arg)
-{
-	int fileLen = SDL_strlen(RWopsHelloWorldTestString);
-	FILE *handle;
-	int writtenLen;
-	int result;
-
-	/* Clean up from previous runs (if any); ignore errors */
-	remove(RWopsReadTestFilename);
-	remove(RWopsWriteTestFilename);
-
-	/* Create a test file */
-	handle = fopen(RWopsReadTestFilename, "w");
-	SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
-    if (handle == NULL) return;
-
-	/* Write some known test into it */
-	writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle);
-	SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen);
-	result = fclose(handle);
-	SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result);
-
-	SDLTest_AssertPass("Creation of test file completed");
-}
-
-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);
-
-	SDLTest_AssertPass("Cleanup of test files completed");
-}
-
-/**
- * @brief Makes sure parameters work properly. Local helper function.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWseek
- * http://wiki.libsdl.org/moin.cgi/SDL_RWread
- */
-void 
-_testGenericRWopsValidations(SDL_RWops *rw, int write)
-{
-   char buf[sizeof(RWopsHelloWorldTestString)];
-   int i;
-   int seekPos = SDLTest_RandomIntegerInRange(4, 8);
-
-   /* Clear buffer */
-   SDL_zero(buf);
-
-   /* Set to start. */
-   i = SDL_RWseek(rw, 0, RW_SEEK_SET );
-   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
-   SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
-
-   /* Test write. */
-   i = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1);
-   SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
-   if (write) {
-		SDLTest_AssertCheck(i == 1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", i);
-   }
-   else {
-		SDLTest_AssertCheck(i <= 0, "Verify result of writing with SDL_RWwrite, expected <=0, got %i", i);
-   }
-
-   /* Test seek to random position */
-   i = SDL_RWseek( rw, seekPos, RW_SEEK_SET );
-   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
-   SDLTest_AssertCheck(i == seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %i", seekPos, seekPos, i);
-
-   /* Test seek back to start */
-   i = SDL_RWseek(rw, 0, RW_SEEK_SET );
-   SDLTest_AssertPass("Call to SDL_RWseek succeeded");
-   SDLTest_AssertCheck(i == 0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
-
-   /* Test read */
-   i = SDL_RWread( rw, buf, 1, sizeof(RWopsHelloWorldTestString)-1 );
-   SDLTest_AssertPass("Call to SDL_RWread succeeded");
-   SDLTest_AssertCheck(
-	   i == (sizeof(RWopsHelloWorldTestString)-1), 
-	   "Verify result from SDL_RWread, expected %i, got %i",
-	   sizeof(RWopsHelloWorldTestString)-1,
-	   i);
-   SDLTest_AssertCheck(
-	   SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0, 
-	   "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
-
-   /* More seek tests. */
-   i = SDL_RWseek( rw, -4, RW_SEEK_CUR );
-   SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded");
-   SDLTest_AssertCheck(
-	   i == (sizeof(RWopsHelloWorldTestString)-5), 
-	   "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i",
-	   sizeof(RWopsHelloWorldTestString)-5,
-	   i);
-
-   i = SDL_RWseek( rw, -1, RW_SEEK_END );
-   SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded");
-   SDLTest_AssertCheck(
-	   i == (sizeof(RWopsHelloWorldTestString)-2), 
-	   "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i",
-	   sizeof(RWopsHelloWorldTestString)-2,
-	   i);
-}
-
-/*!
- * 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;
-}
-
-/**
- * @brief Tests opening from memory.
- *
- * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
- */
-int
-rwops_testMem (void)
-{
-   char mem[sizeof(RWopsHelloWorldTestString)];
-   SDL_RWops *rw;
-
-   /* Clear buffer */
-   SDL_zero(mem);
-
-   /* Open */
-   rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);
-   SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
-
-   /* Bail out if NULL */
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations(rw, 1);
-
-   /* Close */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW(rw);
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-
-   return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests opening from memory.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWFromConstMem
- */
-int 
-rwops_testConstMem (void)
-{
-   SDL_RWops *rw;
-
-   /* Open handle */
-   rw = SDL_RWFromConstMem( RWopsHelloWorldCompString, sizeof(RWopsHelloWorldCompString)-1 );
-   SDLTest_AssertPass("Call to SDL_RWFromConstMem() succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
-
-   /* Bail out if NULL */
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations( rw, 0 );
-
-   /* Close handle */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW( rw );
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-
-  return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests reading from file.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
- * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
- */
-int
-rwops_testFileRead(void)
-{
-   SDL_RWops *rw;
-
-   /* Read test. */
-   rw = SDL_RWFromFile(RWopsReadTestFilename, "r");
-   SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
-
-   // Bail out if NULL
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations( rw, 0 );
-
-   /* Close handle */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW( rw );
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-
-   return TEST_COMPLETED;
-}
-
-/**
- * @brief Tests writing from memory.
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
- * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
- */
-int
-rwops_testFileWrite(void)
-{
-   SDL_RWops *rw;
-
-   /* Write test. */
-   rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
-   SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
-
-   // Bail out if NULL
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations( rw, 1 );
-
-   /* Close handle */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW( rw );
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-
-   return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests reading from file handle
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
- * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
- *
- */
-int
-rwops_testFPRead(void)
-{
-   FILE *fp;
-   SDL_RWops *rw;
-
-   /* Run read tests. */
-   fp = fopen(RWopsReadTestFilename, "r");
-   SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in read mode is not NULL", RWopsReadTestFilename);
-
-   /* Bail out if NULL */
-   if (fp == NULL) return TEST_ABORTED;
-
-   /* Open */
-   rw = SDL_RWFromFP( fp, 1 );
-   SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in read mode does not return NULL");
-
-   /* Bail out if NULL */
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations( rw, 0 );
-
-   /* Close handle */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW( rw );
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-   fclose(fp);
-
-   return TEST_COMPLETED;
-}
-
-
-/**
- * @brief Tests writing to file handle
- *
- * \sa
- * http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
- * http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
- *
- */
-int
-rwops_testFPWrite(void)
-{
-   FILE *fp;
-   SDL_RWops *rw;
-
-   /* Run write tests. */
-   fp = fopen(RWopsWriteTestFilename, "w+");
-   SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in write mode is not NULL", RWopsWriteTestFilename);
-
-   /* Bail out if NULL */
-   if (fp == NULL) return TEST_ABORTED;
-
-   /* Open */
-   rw = SDL_RWFromFP( fp, 1 );
-   SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
-   SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in write mode does not return NULL");
-
-   /* Bail out if NULL */
-   if (rw == NULL) return TEST_ABORTED;
-
-   /* Run generic tests */
-   _testGenericRWopsValidations( rw, 1 );
-
-   /* Close handle */
-   SDL_RWclose(rw);
-   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
-   SDL_FreeRW( rw );
-   SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
-   fclose(fp);
-
-   return TEST_COMPLETED;
-}
-
-/* ================= Test References ================== */
-
-/* RWops test cases */
-static const SDLTest_TestCaseReference rwopsTest1 =
-		{ (SDLTest_TestCaseFp)rwops_testParamNegative, "rwops_testParamNegative", "Negative test for SDL_RWFromFile parameters", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest2 =
-		{ (SDLTest_TestCaseFp)rwops_testMem, "rwops_testMem", "Tests opening from memory", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest3 =
-		{ (SDLTest_TestCaseFp)rwops_testConstMem, "rwops_testConstMem", "Tests opening from (const) memory", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest4 =
-		{ (SDLTest_TestCaseFp)rwops_testFileRead, "rwops_testFileRead", "Tests reading from a file", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest5 =
-		{ (SDLTest_TestCaseFp)rwops_testFileWrite, "rwops_testFileWrite", "Test writing to a file", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest6 =
-		{ (SDLTest_TestCaseFp)rwops_testFPRead, "rwops_testFPRead", "Test reading from file pointer", TEST_ENABLED };
-
-static const SDLTest_TestCaseReference rwopsTest7 =
-		{ (SDLTest_TestCaseFp)rwops_testFPWrite, "rwops_testFPWrite", "Test writing to file pointer", TEST_ENABLED };
-
-/* Sequence of RWops test cases */
-static const SDLTest_TestCaseReference *rwopsTests[] =  {
-	&rwopsTest1, &rwopsTest2, &rwopsTest3, &rwopsTest4, &rwopsTest5, &rwopsTest6, &rwopsTest7, NULL
-};
-
-/* RWops test suite (global) */
-SDLTest_TestSuiteReference rwopsTestSuite = {
-	"RWops",
-	RWopsSetUp,
-	rwopsTests,
-	RWopsTearDown
-};
--- a/test/tests/testsuites.h	Sat Dec 22 17:24:14 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/**
- * Reference to all test suites.
- *
- */
-
-#ifndef _testsuites_h
-#define _testsuites_h
-
-#include "SDL_test.h"
-
-// Test collections
-//extern SDLTest_TestSuiteReference audioTestSuite;
-extern SDLTest_TestSuiteReference clipboardTestSuite;
-//extern SDLTest_TestSuiteReference eventsTestSuite;
-//extern SDLTest_TestSuiteReference keyboardTestSuite;
-extern SDLTest_TestSuiteReference platformTestSuite;
-extern SDLTest_TestSuiteReference rectTestSuite;
-extern SDLTest_TestSuiteReference renderTestSuite;
-extern SDLTest_TestSuiteReference rwopsTestSuite;
-//extern SDLTest_TestSuiteReference surfaceTestSuite;
-//extern SDLTest_TestSuiteReference syswmTestSuite;
-//extern SDLTest_TestSuiteReference videoTestSuite;
-
-// All test suites
-SDLTest_TestSuiteReference *testSuites[] =  {
-//	&audioTestSuite,
-	&clipboardTestSuite,
-//	&eventsTestSuite,
-//	&keyboardTestSuite,
-	&platformTestSuite,
-	&rectTestSuite,
-	&renderTestSuite,
-	&rwopsTestSuite,
-//	&surfaceTestSuite,
-//	&syswmTestSuite,
-//	&videoTestSuite,
-	NULL
-};
-
-#endif