Fix fuzzer random boundary functions; add tests for fuzzer
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Tue, 12 Feb 2013 22:23:42 -0800
changeset 68722f4c95464651
parent 6871 bd681c870ccf
child 6873 f042ae287155
Fix fuzzer random boundary functions; add tests for fuzzer
include/SDL_test_fuzzer.h
src/test/SDL_test_fuzzer.c
test/testautomation_main.c
test/testautomation_sdltest.c
     1.1 --- a/include/SDL_test_fuzzer.h	Tue Feb 12 17:07:21 2013 -0800
     1.2 +++ b/include/SDL_test_fuzzer.h	Tue Feb 12 22:23:42 2013 -0800
     1.3 @@ -158,13 +158,13 @@
     1.4   * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
     1.5   * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
     1.6   * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
     1.7 - * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns -1 (== error value)
     1.8 + * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
     1.9   *
    1.10   * \param boundary1 Lower boundary limit
    1.11   * \param boundary2 Upper boundary limit
    1.12 - * \param validDomain Should the generated boundary be valid or not?
    1.13 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
    1.14   *
    1.15 - * \returns Boundary value in given range or error value (-1)
    1.16 + * \returns Random boundary value for the given range and domain or 0 with error set
    1.17   */
    1.18  Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
    1.19  
    1.20 @@ -179,13 +179,13 @@
    1.21   * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
    1.22   * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
    1.23   * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
    1.24 - * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns -1 (== error value)
    1.25 + * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
    1.26   *
    1.27   * \param boundary1 Lower boundary limit
    1.28   * \param boundary2 Upper boundary limit
    1.29 - * \param validDomain Should the generated boundary be valid or not?
    1.30 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
    1.31   *
    1.32 - * \returns Boundary value in given range or error value (-1)
    1.33 + * \returns Random boundary value for the given range and domain or 0 with error set
    1.34   */
    1.35  Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
    1.36  
    1.37 @@ -200,13 +200,13 @@
    1.38   * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
    1.39   * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
    1.40   * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
    1.41 - * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns -1 (== error value)
    1.42 + * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
    1.43   *
    1.44   * \param boundary1 Lower boundary limit
    1.45   * \param boundary2 Upper boundary limit
    1.46 - * \param validDomain Should the generated boundary be valid or not?
    1.47 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
    1.48   *
    1.49 - * \returns Boundary value in given range or error value (-1)
    1.50 + * \returns Random boundary value for the given range and domain or 0 with error set
    1.51   */
    1.52  Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
    1.53  
    1.54 @@ -221,13 +221,13 @@
    1.55   * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
    1.56   * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
    1.57   * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
    1.58 - * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns -1 (== error value)
    1.59 + * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
    1.60   *
    1.61   * \param boundary1 Lower boundary limit
    1.62   * \param boundary2 Upper boundary limit
    1.63 - * \param validDomain Should the generated boundary be valid or not?
    1.64 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
    1.65   *
    1.66 - * \returns Boundary value in given range or error value (-1)
    1.67 + * \returns Random boundary value for the given range and domain or 0 with error set
    1.68   */
    1.69  Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
    1.70  
    1.71 @@ -241,14 +241,14 @@
    1.72   * Usage examples:
    1.73   * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
    1.74   * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
    1.75 - * RandomSint8BoundaryValue(-128, 99, SDL_FALSE) returns 100
    1.76 - * RandomSint8BoundaryValue(-128, 127, SDL_FALSE) returns SINT8_MIN (== error value)
    1.77 + * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
    1.78 + * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
    1.79   *
    1.80   * \param boundary1 Lower boundary limit
    1.81   * \param boundary2 Upper boundary limit
    1.82 - * \param validDomain Should the generated boundary be valid or not?
    1.83 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
    1.84   *
    1.85 - * \returns Boundary value in given range or error value (-1)
    1.86 + * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
    1.87   */
    1.88  Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
    1.89  
    1.90 @@ -263,14 +263,14 @@
    1.91   * Usage examples:
    1.92   * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
    1.93   * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
    1.94 - * RandomSint16BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
    1.95 - * RandomSint16BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT16_MIN (== error value)
    1.96 + * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
    1.97 + * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
    1.98   *
    1.99   * \param boundary1 Lower boundary limit
   1.100   * \param boundary2 Upper boundary limit
   1.101 - * \param validDomain Should the generated boundary be valid or not?
   1.102 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
   1.103   *
   1.104 - * \returns Boundary value in given range or error value (-1)
   1.105 + * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
   1.106   */
   1.107  Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
   1.108  
   1.109 @@ -289,9 +289,9 @@
   1.110   *
   1.111   * \param boundary1 Lower boundary limit
   1.112   * \param boundary2 Upper boundary limit
   1.113 - * \param validDomain Should the generated boundary be valid or not?
   1.114 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
   1.115   *
   1.116 - * \returns Boundary value in given range or error value (-1)
   1.117 + * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
   1.118   */
   1.119  Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
   1.120  
   1.121 @@ -306,13 +306,13 @@
   1.122   * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
   1.123   * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
   1.124   * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
   1.125 - * RandomSint64BoundaryValue(SINT64_MIN, SINT32_MAX, SDL_FALSE) returns SINT64_MIN (== error value)
   1.126 + * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
   1.127   *
   1.128   * \param boundary1 Lower boundary limit
   1.129   * \param boundary2 Upper boundary limit
   1.130 - * \param validDomain Should the generated boundary be valid or not?
   1.131 + * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
   1.132   *
   1.133 - * \returns Boundary value in given range or error value (-1)
   1.134 + * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
   1.135   */
   1.136  Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
   1.137  
     2.1 --- a/src/test/SDL_test_fuzzer.c	Tue Feb 12 17:07:21 2013 -0800
     2.2 +++ b/src/test/SDL_test_fuzzer.c	Tue Feb 12 22:23:42 2013 -0800
     2.3 @@ -44,7 +44,7 @@
     2.4  #include "SDL_test.h"
     2.5  
     2.6  /** 
     2.7 - *Counter for fuzzer invocations
     2.8 + * Counter for fuzzer invocations
     2.9   */
    2.10  static int fuzzerInvocationCounter = 0;
    2.11  
    2.12 @@ -167,414 +167,268 @@
    2.13  		return (Sint32)min;
    2.14  	}
    2.15  
    2.16 -	number = SDLTest_RandomUint32(); // invocation count increment in there
    2.17 +	number = SDLTest_RandomUint32(); 
    2.18 +	/* invocation count increment in preceeding call */
    2.19  
    2.20  	return (Sint32)((number % ((max + 1) - min)) + min);
    2.21  }
    2.22  
    2.23  /*!
    2.24 - * Generates boundary values between the given boundaries.
    2.25 + * Generates a unsigned boundary value between the given boundaries.
    2.26   * Boundary values are inclusive. See the examples below.
    2.27   * If boundary2 < boundary1, the values are swapped.
    2.28   * If boundary1 == boundary2, value of boundary1 will be returned
    2.29   *
    2.30   * Generating boundary values for Uint8:
    2.31 - * BoundaryValues(sizeof(Uint8), 10, 20, True) -> [10,11,19,20]
    2.32 - * BoundaryValues(sizeof(Uint8), 10, 20, False) -> [9,21]
    2.33 - * BoundaryValues(sizeof(Uint8), 0, 15, True) -> [0, 1, 14, 15]
    2.34 - * BoundaryValues(sizeof(Uint8), 0, 15, False) -> [16]
    2.35 - * BoundaryValues(sizeof(Uint8), 0, 255, False) -> NULL
    2.36 + * BoundaryValues(UINT8_MAX, 10, 20, True) -> [10,11,19,20]
    2.37 + * BoundaryValues(UINT8_MAX, 10, 20, False) -> [9,21]
    2.38 + * BoundaryValues(UINT8_MAX, 0, 15, True) -> [0, 1, 14, 15]
    2.39 + * BoundaryValues(UINT8_MAX, 0, 15, False) -> [16]
    2.40 + * BoundaryValues(UINT8_MAX, 0, 0xFF, False) -> [0], error set
    2.41   *
    2.42   * Generator works the same for other types of unsigned integers.
    2.43   *
    2.44 - * Note: outBuffer will be allocated and needs to be freed later.
    2.45 - * If outbuffer != NULL, it'll be freed.
    2.46 - *
    2.47   * \param maxValue The biggest value that is acceptable for this data type.
    2.48   * 					For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
    2.49 - * \param pBoundary1 defines lower boundary
    2.50 - * \param pBoundary2 defines upper boundary
    2.51 + * \param boundary1 defines lower boundary
    2.52 + * \param boundary2 defines upper boundary
    2.53   * \param validDomain Generate only for valid domain (for the data type)
    2.54   *
    2.55 - * \param outBuffer The generated boundary values are put here
    2.56 - *
    2.57 - * \returns Returns the number of elements in outBuffer or -1 in case of error
    2.58 + * \returns Returns a random boundary value for the domain or 0 in case of error
    2.59   */
    2.60 -Uint32
    2.61 -SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue,
    2.62 -					Uint64 pBoundary1, Uint64 pBoundary2, SDL_bool validDomain,
    2.63 -					Uint64 *outBuffer)
    2.64 +Uint64
    2.65 +SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
    2.66  {
    2.67 -	Uint64 boundary1 = pBoundary1, boundary2 = pBoundary2;
    2.68 -	Uint64 temp;
    2.69 +        Uint64 b1, b2;
    2.70 +	Uint64 delta;
    2.71  	Uint64 tempBuf[4];
    2.72 -	int index;
    2.73 -
    2.74 -	if(outBuffer != NULL) {
    2.75 -		SDL_free(outBuffer);
    2.76 -	}
    2.77 -
    2.78 -	if(boundary1 > boundary2) {
    2.79 -		temp = boundary1;
    2.80 -		boundary1 = boundary2;
    2.81 -		boundary2 = temp;
    2.82 -	}
    2.83 +	Uint8 index;
    2.84 +	
    2.85 +        /* Maybe swap */
    2.86 +	if (boundary1 > boundary2) {
    2.87 +		b1 = boundary2;
    2.88 +		b2 = boundary1;
    2.89 +	} else {
    2.90 +		b1 = boundary1;
    2.91 +		b2 = boundary2;
    2.92 +        }
    2.93  
    2.94  	index = 0;
    2.95 -	if(boundary1 == boundary2) {
    2.96 -		tempBuf[index++] = boundary1;
    2.97 -	}
    2.98 -	else if(validDomain) {
    2.99 -		tempBuf[index++] = boundary1;
   2.100 -
   2.101 -		if(boundary1 < UINT64_MAX)
   2.102 -			tempBuf[index++] = boundary1 + 1;
   2.103 -
   2.104 -		tempBuf[index++] = boundary2 - 1;
   2.105 -		tempBuf[index++] = boundary2;
   2.106 -	}
   2.107 -	else {
   2.108 -		if(boundary1 > 0) {
   2.109 -			tempBuf[index++] = boundary1 - 1;
   2.110 +	if (validDomain == SDL_TRUE) {
   2.111 +	        if (b1 == b2) {
   2.112 +	            return b1;
   2.113 +	        }
   2.114 +	        
   2.115 +	        /* Generate up to 4 values within bounds */
   2.116 +	        delta = b2 - b1;
   2.117 +	        if (delta < 4) {
   2.118 +	            do {
   2.119 +		        tempBuf[index] = b1 + index;
   2.120 +		        index++;
   2.121 +                    } while (index < delta);
   2.122 +	        } else {
   2.123 +		  tempBuf[index] = b1;
   2.124 +		  index++;
   2.125 +		  tempBuf[index] = b1 + 1;
   2.126 +		  index++;
   2.127 +		  tempBuf[index] = b2 - 1;
   2.128 +		  index++;
   2.129 +		  tempBuf[index] = b2;
   2.130 +		  index++;
   2.131 +	        }
   2.132 +        } else {                
   2.133 +	        /* Generate up to 2 values outside of bounds */
   2.134 +		if (b1 > 0) {
   2.135 +			tempBuf[index] = b1 - 1;
   2.136 +			index++;
   2.137  		}
   2.138  
   2.139 -		if(boundary2 < maxValue && boundary2 < UINT64_MAX) {
   2.140 -			tempBuf[index++] = boundary2 + 1;
   2.141 +		if (b2 < maxValue) {
   2.142 +			tempBuf[index] = b2 + 1;
   2.143 +			index++;
   2.144  		}
   2.145  	}
   2.146  
   2.147 -	if(index == 0) {
   2.148 -		// There are no valid boundaries
   2.149 +	if (index == 0) {
   2.150 +		/* There are no valid boundaries */
   2.151 +		SDL_Error(SDL_UNSUPPORTED);
   2.152  		return 0;
   2.153  	}
   2.154  
   2.155 -	// Create the return buffer
   2.156 -	outBuffer = (Uint64 *)SDL_malloc(index * sizeof(Uint64));
   2.157 -	if(outBuffer == NULL) {
   2.158 -		return 0;
   2.159 -	}
   2.160 +	return tempBuf[SDLTest_RandomUint8() % index];
   2.161 +}
   2.162  
   2.163 -	SDL_memcpy(outBuffer, tempBuf, index * sizeof(Uint64));
   2.164 -
   2.165 -	return index;
   2.166 -}
   2.167  
   2.168  Uint8
   2.169  SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
   2.170  {
   2.171 -	Uint64 *buffer = NULL;
   2.172 -	Uint32 size;
   2.173 -	Uint32 index;
   2.174 -	Uint8 retVal;
   2.175 -
   2.176 -	// max value for Uint8
   2.177 -	const Uint64 maxValue = UINT8_MAX;
   2.178 -
   2.179 -	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.180 +	/* max value for Uint8 */
   2.181 +	const Uint64 maxValue = UCHAR_MAX;
   2.182 +	return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.183  				(Uint64) boundary1, (Uint64) boundary2,
   2.184 -				validDomain, buffer);
   2.185 -	if (buffer == NULL || size == 0) {
   2.186 -		return 0;
   2.187 -	}
   2.188 -
   2.189 -	index = SDLTest_RandomSint32() % size;
   2.190 -	retVal = (Uint8)buffer[index];
   2.191 -
   2.192 -	SDL_free(buffer);
   2.193 -
   2.194 -	fuzzerInvocationCounter++;
   2.195 -
   2.196 -	return retVal;
   2.197 +				validDomain);
   2.198  }
   2.199  
   2.200  Uint16
   2.201  SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)
   2.202  {
   2.203 -	Uint64 *buffer = NULL;
   2.204 -	Uint32 size;
   2.205 -	Uint32 index;
   2.206 -	Uint16 retVal;
   2.207 -
   2.208 -	// max value for Uint16
   2.209 -	const Uint64 maxValue = UINT16_MAX;
   2.210 -
   2.211 -	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.212 +	/* max value for Uint16 */
   2.213 +	const Uint64 maxValue = USHRT_MAX;
   2.214 +	return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.215  				(Uint64) boundary1, (Uint64) boundary2,
   2.216 -				validDomain, buffer);
   2.217 -	if (buffer == NULL || size == 0) {
   2.218 -		return 0;
   2.219 -	}
   2.220 -
   2.221 -	index = SDLTest_RandomSint32() % size;
   2.222 -	retVal = (Uint16) buffer[index];
   2.223 -
   2.224 -	SDL_free(buffer);
   2.225 -
   2.226 -	fuzzerInvocationCounter++;
   2.227 -
   2.228 -	return retVal;
   2.229 +				validDomain);
   2.230  }
   2.231  
   2.232  Uint32
   2.233  SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)
   2.234  {
   2.235 -	Uint64 *buffer = NULL;
   2.236 -	Uint32 size;
   2.237 -	Uint32 index;
   2.238 -	Uint32 retVal;
   2.239 -
   2.240 -	// max value for Uint32
   2.241 -	const Uint64 maxValue = UINT32_MAX;
   2.242 -
   2.243 -	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.244 +	/* max value for Uint32 */
   2.245 +	const Uint64 maxValue = ULONG_MAX;
   2.246 +	return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.247  				(Uint64) boundary1, (Uint64) boundary2,
   2.248 -				validDomain, buffer);
   2.249 -	if (buffer == NULL || size == 0) {
   2.250 -		return 0;
   2.251 -	}
   2.252 -
   2.253 -	index = SDLTest_RandomSint32() % size;
   2.254 -	retVal = (Uint32) buffer[index];
   2.255 -
   2.256 -	SDL_free(buffer);
   2.257 -
   2.258 -	fuzzerInvocationCounter++;
   2.259 -
   2.260 -	return retVal;
   2.261 +				validDomain);
   2.262  }
   2.263  
   2.264  Uint64
   2.265  SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
   2.266  {
   2.267 -	Uint64 *buffer = NULL;
   2.268 -	Uint32 size;
   2.269 -	Uint32 index;
   2.270 -	Uint64 retVal;
   2.271 -
   2.272 -	// max value for Uint64
   2.273 -	const Uint64 maxValue = UINT64_MAX;
   2.274 -
   2.275 -	size = SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.276 +	/* max value for Uint64 */
   2.277 +	const Uint64 maxValue = ULLONG_MAX;
   2.278 +	return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   2.279  				(Uint64) boundary1, (Uint64) boundary2,
   2.280 -				validDomain, buffer);
   2.281 -	if (buffer == NULL || size == 0) {
   2.282 -		return 0;
   2.283 -	}
   2.284 -
   2.285 -	index = SDLTest_RandomSint32() % size;
   2.286 -	retVal = (Uint64) buffer[index];
   2.287 -
   2.288 -	SDL_free(buffer);
   2.289 -
   2.290 -	fuzzerInvocationCounter++;
   2.291 -
   2.292 -	return retVal;
   2.293 +				validDomain);
   2.294  }
   2.295  
   2.296  /*!
   2.297 - * Generates boundary values between the given boundaries.
   2.298 + * Generates a signed boundary value between the given boundaries.
   2.299   * Boundary values are inclusive. See the examples below.
   2.300   * If boundary2 < boundary1, the values are swapped.
   2.301   * If boundary1 == boundary2, value of boundary1 will be returned
   2.302   *
   2.303   * Generating boundary values for Sint8:
   2.304 - * SignedBoundaryValues(sizeof(Sint8), -10, 20, True) -> [-11,-10,19,20]
   2.305 - * SignedBoundaryValues(sizeof(Sint8), -10, 20, False) -> [-11,21]
   2.306 - * SignedBoundaryValues(sizeof(Sint8), -30, -15, True) -> [-30, -29, -16, -15]
   2.307 - * SignedBoundaryValues(sizeof(Sint8), -128, 15, False) -> [16]
   2.308 - * SignedBoundaryValues(sizeof(Sint8), -128, 127, False) -> NULL
   2.309 + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, True) -> [-10,-9,19,20]
   2.310 + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, False) -> [-11,21]
   2.311 + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -30, -15, True) -> [-30, -29, -16, -15]
   2.312 + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 15, False) -> [16]
   2.313 + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 127, False) -> [0], error set
   2.314   *
   2.315   * Generator works the same for other types of signed integers.
   2.316   *
   2.317 - * Note: outBuffer will be allocated and needs to be freed later.
   2.318 - * If outbuffer != NULL, it'll be freed.
   2.319 - *
   2.320 - *
   2.321 - * \param minValue The smallest value  that is acceptable for this data type.
   2.322 - *					For instance, for Uint8 -> -128, Uint16 -> -32,768 etc.
   2.323 + * \param minValue The smallest value that is acceptable for this data type.
   2.324 + * 					For instance, for Uint8 -> -127, etc.
   2.325   * \param maxValue The biggest value that is acceptable for this data type.
   2.326 - * 					For instance, for Uint8 -> 127, Uint16 -> 32767 etc.
   2.327 - * \param pBoundary1 defines lower boundary
   2.328 - * \param pBoundary2 defines upper boundary
   2.329 + * 					For instance, for Uint8 -> 127, etc.
   2.330 + * \param boundary1 defines lower boundary
   2.331 + * \param boundary2 defines upper boundary
   2.332   * \param validDomain Generate only for valid domain (for the data type)
   2.333   *
   2.334 - * \param outBuffer The generated boundary values are put here
   2.335 - *
   2.336 - * \returns Returns the number of elements in outBuffer or -1 in case of error
   2.337 + * \returns Returns a random boundary value for the domain or 0 in case of error
   2.338   */
   2.339 -Uint32
   2.340 -SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue,
   2.341 -					Sint64 pBoundary1, Sint64 pBoundary2, SDL_bool validDomain,
   2.342 -					Sint64 *outBuffer)
   2.343 +Sint64
   2.344 +SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
   2.345  {
   2.346 -	int index;
   2.347 +        Sint64 b1, b2;
   2.348 +	Sint64 delta;
   2.349  	Sint64 tempBuf[4];
   2.350 -	Sint64 boundary1 = pBoundary1, boundary2 = pBoundary2;
   2.351 -
   2.352 -	if(outBuffer != NULL) {
   2.353 -		SDL_free(outBuffer);
   2.354 -	}
   2.355 -
   2.356 -	if(boundary1 > boundary2) {
   2.357 -		Sint64 temp = boundary1;
   2.358 -		boundary1 = boundary2;
   2.359 -		boundary2 = temp;
   2.360 -	}
   2.361 +	Uint8 index;
   2.362 +	
   2.363 +        /* Maybe swap */
   2.364 +	if (boundary1 > boundary2) {
   2.365 +		b1 = boundary2;
   2.366 +		b2 = boundary1;
   2.367 +	} else {
   2.368 +		b1 = boundary1;
   2.369 +		b2 = boundary2;
   2.370 +        }
   2.371  
   2.372  	index = 0;
   2.373 -	if(boundary1 == boundary2) {
   2.374 -		tempBuf[index++] = boundary1;
   2.375 -	}
   2.376 -	else if(validDomain) {
   2.377 -		tempBuf[index++] = boundary1;
   2.378 -
   2.379 -		if(boundary1 < LLONG_MAX)
   2.380 -			tempBuf[index++] = boundary1 + 1;
   2.381 -
   2.382 -		if(boundary2 > LLONG_MIN)
   2.383 -			tempBuf[index++] = boundary2 - 1;
   2.384 -
   2.385 -		tempBuf[index++] = boundary2;
   2.386 -	}
   2.387 -	else {
   2.388 -		if(boundary1 > minValue &&  boundary1 > LLONG_MIN) {
   2.389 -			tempBuf[index++] = boundary1 - 1;
   2.390 +	if (validDomain == SDL_TRUE) {
   2.391 +	        if (b1 == b2) {
   2.392 +	            return b1;
   2.393 +	        }
   2.394 +	        
   2.395 +	        /* Generate up to 4 values within bounds */
   2.396 +	        delta = b2 - b1;
   2.397 +	        if (delta < 4) {
   2.398 +	            do {
   2.399 +		        tempBuf[index] = b1 + index;
   2.400 +		        index++;
   2.401 +                    } while (index < delta);
   2.402 +	        } else {
   2.403 +		  tempBuf[index] = b1;
   2.404 +		  index++;
   2.405 +		  tempBuf[index] = b1 + 1;
   2.406 +		  index++;
   2.407 +		  tempBuf[index] = b2 - 1;
   2.408 +		  index++;
   2.409 +		  tempBuf[index] = b2;
   2.410 +		  index++;
   2.411 +	        }
   2.412 +        } else {                
   2.413 +	        /* Generate up to 2 values outside of bounds */
   2.414 +		if (b1 > minValue) {
   2.415 +			tempBuf[index] = b1 - 1;
   2.416 +			index++;
   2.417  		}
   2.418  
   2.419 -		if(boundary2 < maxValue && boundary2 < UINT64_MAX) {
   2.420 -			tempBuf[index++] = boundary2 + 1;
   2.421 +		if (b2 < maxValue) {
   2.422 +			tempBuf[index] = b2 + 1;
   2.423 +			index++;
   2.424  		}
   2.425  	}
   2.426  
   2.427 -	if(index == 0) {
   2.428 -		// There are no valid boundaries
   2.429 -		return 0;
   2.430 +	if (index == 0) {
   2.431 +		/* There are no valid boundaries */
   2.432 +		SDL_Error(SDL_UNSUPPORTED);
   2.433 +		return minValue;
   2.434  	}
   2.435  
   2.436 -	// Create the return buffer
   2.437 -	outBuffer = (Sint64 *)SDL_malloc(index * sizeof(Sint64));
   2.438 -	if(outBuffer == NULL) {
   2.439 -		return 0;
   2.440 -	}
   2.441 +	return tempBuf[SDLTest_RandomUint8() % index];
   2.442 +}
   2.443  
   2.444 -	SDL_memcpy((void *)outBuffer, (void *)tempBuf, index * sizeof(Sint64));
   2.445 -
   2.446 -	return (Uint32)index;
   2.447 -}
   2.448  
   2.449  Sint8
   2.450  SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
   2.451  {
   2.452 -	// min & max values for Sint8
   2.453 -	const Sint64 maxValue = CHAR_MAX;
   2.454 -	const Sint64 minValue = CHAR_MIN;
   2.455 -
   2.456 -	Sint64 *buffer = NULL;
   2.457 -	Uint32 size;
   2.458 -	Uint32 index;
   2.459 -	Sint8 retVal;
   2.460 -
   2.461 -	size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.462 +	/* min & max values for Sint8 */
   2.463 +	const Sint64 maxValue = SCHAR_MAX;
   2.464 +	const Sint64 minValue = SCHAR_MIN;
   2.465 +	return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.466  				(Sint64) boundary1, (Sint64) boundary2,
   2.467 -				validDomain, buffer);
   2.468 -	if (buffer == NULL || size == 0) {
   2.469 -		return CHAR_MIN;
   2.470 -	}
   2.471 -
   2.472 -	index = SDLTest_RandomSint32() % size;
   2.473 -	retVal = (Sint8) buffer[index];
   2.474 -
   2.475 -	SDL_free(buffer);
   2.476 -
   2.477 -	fuzzerInvocationCounter++;
   2.478 -
   2.479 -	return retVal;
   2.480 +				validDomain);
   2.481  }
   2.482  
   2.483  Sint16
   2.484  SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)
   2.485  {
   2.486 -	// min & max values for Sint16
   2.487 +	/* min & max values for Sint16 */
   2.488  	const Sint64 maxValue = SHRT_MAX;
   2.489  	const Sint64 minValue = SHRT_MIN;
   2.490 -	Sint64 *buffer = NULL;
   2.491 -	Uint32 size;
   2.492 -	Uint32 index;
   2.493 -	Sint16 retVal;
   2.494 -
   2.495 -	size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.496 -					(Sint64) boundary1, (Sint64) boundary2,
   2.497 -					validDomain, buffer);
   2.498 -	if (buffer == NULL || size == 0) {
   2.499 -		return SHRT_MIN;
   2.500 -	}
   2.501 -
   2.502 -	index = SDLTest_RandomSint32() % size;
   2.503 -	retVal = (Sint16) buffer[index];
   2.504 -
   2.505 -	SDL_free(buffer);
   2.506 -
   2.507 -	fuzzerInvocationCounter++;
   2.508 -
   2.509 -	return retVal;
   2.510 +	return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.511 +				(Sint64) boundary1, (Sint64) boundary2,
   2.512 +				validDomain);
   2.513  }
   2.514  
   2.515  Sint32
   2.516  SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
   2.517  {
   2.518 -	// min & max values for Sint32
   2.519 -	const Sint64 maxValue = INT_MAX;
   2.520 -	const Sint64 minValue = INT_MIN;
   2.521 -
   2.522 -	Sint64 *buffer = NULL;
   2.523 -	Uint32 size;
   2.524 -	Uint32 index;
   2.525 -	Sint32 retVal;
   2.526 -
   2.527 -	size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.528 +	/* min & max values for Sint32 */
   2.529 +	const Sint64 maxValue = LONG_MAX;
   2.530 +	const Sint64 minValue = LONG_MIN;
   2.531 +	return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.532  				(Sint64) boundary1, (Sint64) boundary2,
   2.533 -				validDomain, buffer);
   2.534 -	if (buffer == NULL || size == 0) {
   2.535 -		return INT_MIN;
   2.536 -	}
   2.537 -
   2.538 -	index = SDLTest_RandomSint32() % size;
   2.539 -	retVal = (Sint32) buffer[index];
   2.540 -
   2.541 -	SDL_free(buffer);
   2.542 -
   2.543 -	fuzzerInvocationCounter++;
   2.544 -
   2.545 -	return retVal;
   2.546 +				validDomain);
   2.547  }
   2.548  
   2.549  Sint64
   2.550  SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
   2.551  {
   2.552 -	Sint64 *buffer = NULL;
   2.553 -	Uint32 size;
   2.554 -	Uint32 index;
   2.555 -	Sint64 retVal;
   2.556 -
   2.557 -	// min & max values for Sint64
   2.558 +	/* min & max values for Sint64 */
   2.559  	const Sint64 maxValue = LLONG_MAX;
   2.560  	const Sint64 minValue = LLONG_MIN;
   2.561 -
   2.562 -	size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.563 -				(Sint64) boundary1, (Sint64) boundary2,
   2.564 -				validDomain, buffer);
   2.565 -	if (buffer == NULL || size == 0) {
   2.566 -		return LLONG_MIN;
   2.567 -	}
   2.568 -
   2.569 -	index = SDLTest_RandomSint32() % size;
   2.570 -	retVal = (Sint64) buffer[index];
   2.571 -
   2.572 -	SDL_free(buffer);
   2.573 -
   2.574 -	fuzzerInvocationCounter++;
   2.575 -
   2.576 -	return retVal;
   2.577 +	return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   2.578 +				boundary1, boundary2,
   2.579 +				validDomain);
   2.580  }
   2.581  
   2.582  float
     3.1 --- a/test/testautomation_main.c	Tue Feb 12 17:07:21 2013 -0800
     3.2 +++ b/test/testautomation_main.c	Tue Feb 12 22:23:42 2013 -0800
     3.3 @@ -81,6 +81,8 @@
     3.4      SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
     3.5      initialized_system = SDL_WasInit(joy_and_controller);
     3.6      SDLTest_AssertCheck( (initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
     3.7 +
     3.8 +	return TEST_COMPLETED;
     3.9  }
    3.10  
    3.11  static int main_testImpliedJoystickQuit (void *arg)
    3.12 @@ -103,6 +105,8 @@
    3.13      SDLTest_AssertCheck( (initialized_system & joy_and_controller) == SDL_INIT_JOYSTICK, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
    3.14  
    3.15      SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
    3.16 +
    3.17 +	return TEST_COMPLETED;
    3.18  }
    3.19  
    3.20  static const SDLTest_TestCaseReference mainTest1 =
     4.1 --- a/test/testautomation_sdltest.c	Tue Feb 12 17:07:21 2013 -0800
     4.2 +++ b/test/testautomation_sdltest.c	Tue Feb 12 22:23:42 2013 -0800
     4.3 @@ -50,7 +50,7 @@
     4.4    result = (Sint64)SDLTest_RandomUint8();
     4.5    umax = (1 << 8) - 1;
     4.6    SDLTest_AssertPass("Call to SDLTest_RandomUint8");
     4.7 -  SDLTest_AssertCheck(result >= 0 && result <= umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
     4.8 +  SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
     4.9  
    4.10    result = (Sint64)SDLTest_RandomSint8();
    4.11    min = 1 - (1 << 7);
    4.12 @@ -61,7 +61,7 @@
    4.13    result = (Sint64)SDLTest_RandomUint16();
    4.14    umax = (1 << 16) - 1;
    4.15    SDLTest_AssertPass("Call to SDLTest_RandomUint16");
    4.16 -  SDLTest_AssertCheck(result >= 0 && result <= umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
    4.17 +  SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
    4.18  
    4.19    result = (Sint64)SDLTest_RandomSint16();
    4.20    min = 1 - (1 << 15);
    4.21 @@ -72,18 +72,7 @@
    4.22    result = (Sint64)SDLTest_RandomUint32();
    4.23    umax = ((Uint64)1 << 32) - 1;
    4.24    SDLTest_AssertPass("Call to SDLTest_RandomUint32");
    4.25 -  SDLTest_AssertCheck(result >= 0 && result <= umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
    4.26 -
    4.27 -  result = (Sint64)SDLTest_RandomSint32();
    4.28 -  min = 1 - ((Sint64)1 << 31);
    4.29 -  max =     ((Sint64)1 << 31) - 1;
    4.30 -  SDLTest_AssertPass("Call to SDLTest_RandomSint32");
    4.31 -  SDLTest_AssertCheck(result >= min && result <= max, "Verify result value, expected: [%lld,%lld], got: %lld", min, max, result);
    4.32 -
    4.33 -  result = (Sint64)SDLTest_RandomUint32();
    4.34 -  umax = ((Uint64)1 << 32) - 1;
    4.35 -  SDLTest_AssertPass("Call to SDLTest_RandomUint32");
    4.36 -  SDLTest_AssertCheck(result >= 0 && result <= umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
    4.37 +  SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%llu], got: %lld", umax, result);
    4.38  
    4.39    result = (Sint64)SDLTest_RandomSint32();
    4.40    min = 1 - ((Sint64)1 << 31);
    4.41 @@ -115,6 +104,887 @@
    4.42    return TEST_COMPLETED;
    4.43  }
    4.44  
    4.45 +/*
    4.46 + * @brief Calls to random boundary number generators for Uint8
    4.47 + */
    4.48 +int
    4.49 +sdltest_randomBoundaryNumberUint8(void *arg)
    4.50 +{
    4.51 +  const char *expectedError = "That operation is not supported";
    4.52 +  char *lastError;
    4.53 +  Uint64 uresult;
    4.54 +
    4.55 +  /* Clean error messages */
    4.56 +  SDL_ClearError();
    4.57 +  SDLTest_AssertPass("SDL_ClearError()");
    4.58 +
    4.59 +  /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
    4.60 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 10, SDL_TRUE);
    4.61 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.62 +  SDLTest_AssertCheck(
    4.63 +    uresult == 10,
    4.64 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", uresult);  
    4.65 +
    4.66 +  /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
    4.67 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 11, SDL_TRUE);
    4.68 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.69 +  SDLTest_AssertCheck(
    4.70 +    uresult == 10 || uresult == 11,
    4.71 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", uresult);  
    4.72 +
    4.73 +  /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
    4.74 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 12, SDL_TRUE);
    4.75 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.76 +  SDLTest_AssertCheck(
    4.77 +    uresult == 10 || uresult == 11 || uresult == 12,
    4.78 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", uresult);  
    4.79 +
    4.80 +  /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
    4.81 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 13, SDL_TRUE);
    4.82 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.83 +  SDLTest_AssertCheck(
    4.84 +    uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
    4.85 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", uresult);  
    4.86 +
    4.87 +  /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
    4.88 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 20, SDL_TRUE);
    4.89 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.90 +  SDLTest_AssertCheck(
    4.91 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
    4.92 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
    4.93 +
    4.94 +  /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
    4.95 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(20, 10, SDL_TRUE);
    4.96 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
    4.97 +  SDLTest_AssertCheck(
    4.98 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
    4.99 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.100 +
   4.101 +  /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.102 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 20, SDL_FALSE);
   4.103 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   4.104 +  SDLTest_AssertCheck(
   4.105 +    uresult == 0 || uresult == 21,
   4.106 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", uresult);  
   4.107 +            
   4.108 +  /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   4.109 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 99, SDL_FALSE);
   4.110 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   4.111 +  SDLTest_AssertCheck(
   4.112 +    uresult == 100,
   4.113 +    "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %lld", uresult);  
   4.114 +
   4.115 +  /* RandomUintXBoundaryValue(1, 0xff, SDL_FALSE) returns 0 (no error) */
   4.116 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 255, SDL_FALSE);
   4.117 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   4.118 +  SDLTest_AssertCheck(
   4.119 +    uresult == 0,
   4.120 +    "Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.121 +  lastError = (char *)SDL_GetError();
   4.122 +  SDLTest_AssertPass("SDL_GetError()");
   4.123 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.124 +
   4.125 +  /* RandomUintXBoundaryValue(0, 0xfe, SDL_FALSE) returns 0xff (no error) */
   4.126 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 254, SDL_FALSE);
   4.127 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   4.128 +  SDLTest_AssertCheck(
   4.129 +    uresult == 0xff,
   4.130 +    "Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %lld", uresult);
   4.131 +  lastError = (char *)SDL_GetError();
   4.132 +  SDLTest_AssertPass("SDL_GetError()");
   4.133 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.134 +
   4.135 +  /* RandomUintXBoundaryValue(0, 0xff, SDL_FALSE) returns 0 (sets error) */
   4.136 +  uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 255, SDL_FALSE);
   4.137 +  SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   4.138 +  SDLTest_AssertCheck(
   4.139 +    uresult == 0,
   4.140 +    "Validate result value for parameters(0,255,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.141 +  lastError = (char *)SDL_GetError();
   4.142 +  SDLTest_AssertPass("SDL_GetError()");
   4.143 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.144 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.145 +             expectedError,
   4.146 +             lastError);
   4.147 +
   4.148 +  /* Clear error messages */
   4.149 +  SDL_ClearError();
   4.150 +  SDLTest_AssertPass("SDL_ClearError()");
   4.151 +
   4.152 +  return TEST_COMPLETED;
   4.153 +}
   4.154 +
   4.155 +/*
   4.156 + * @brief Calls to random boundary number generators for Uint16
   4.157 + */
   4.158 +int
   4.159 +sdltest_randomBoundaryNumberUint16(void *arg)
   4.160 +{
   4.161 +  const char *expectedError = "That operation is not supported";
   4.162 +  char *lastError;
   4.163 +  Uint64 uresult;
   4.164 +
   4.165 +  /* Clean error messages */
   4.166 +  SDL_ClearError();
   4.167 +  SDLTest_AssertPass("SDL_ClearError()");
   4.168 +
   4.169 +  /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.170 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 10, SDL_TRUE);
   4.171 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.172 +  SDLTest_AssertCheck(
   4.173 +    uresult == 10,
   4.174 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", uresult);  
   4.175 +
   4.176 +  /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.177 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 11, SDL_TRUE);
   4.178 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.179 +  SDLTest_AssertCheck(
   4.180 +    uresult == 10 || uresult == 11,
   4.181 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", uresult);  
   4.182 +
   4.183 +  /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.184 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 12, SDL_TRUE);
   4.185 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.186 +  SDLTest_AssertCheck(
   4.187 +    uresult == 10 || uresult == 11 || uresult == 12,
   4.188 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", uresult);  
   4.189 +
   4.190 +  /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.191 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 13, SDL_TRUE);
   4.192 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.193 +  SDLTest_AssertCheck(
   4.194 +    uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   4.195 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", uresult);  
   4.196 +
   4.197 +  /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.198 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 20, SDL_TRUE);
   4.199 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.200 +  SDLTest_AssertCheck(
   4.201 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.202 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.203 +
   4.204 +  /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.205 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(20, 10, SDL_TRUE);
   4.206 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.207 +  SDLTest_AssertCheck(
   4.208 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.209 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.210 +
   4.211 +  /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.212 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 20, SDL_FALSE);
   4.213 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.214 +  SDLTest_AssertCheck(
   4.215 +    uresult == 0 || uresult == 21,
   4.216 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", uresult);  
   4.217 +            
   4.218 +  /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   4.219 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 99, SDL_FALSE);
   4.220 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.221 +  SDLTest_AssertCheck(
   4.222 +    uresult == 100,
   4.223 +    "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %lld", uresult);  
   4.224 +
   4.225 +  /* RandomUintXBoundaryValue(1, 0xffff, SDL_FALSE) returns 0 (no error) */
   4.226 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 0xffff, SDL_FALSE);
   4.227 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.228 +  SDLTest_AssertCheck(
   4.229 +    uresult == 0,
   4.230 +    "Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.231 +  lastError = (char *)SDL_GetError();
   4.232 +  SDLTest_AssertPass("SDL_GetError()");
   4.233 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.234 +
   4.235 +  /* RandomUintXBoundaryValue(0, 0xfffe, SDL_FALSE) returns 0xffff (no error) */
   4.236 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xfffe, SDL_FALSE);
   4.237 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.238 +  SDLTest_AssertCheck(
   4.239 +    uresult == 0xffff,
   4.240 +    "Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %lld", uresult);
   4.241 +  lastError = (char *)SDL_GetError();
   4.242 +  SDLTest_AssertPass("SDL_GetError()");
   4.243 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.244 +
   4.245 +  /* RandomUintXBoundaryValue(0, 0xffff, SDL_FALSE) returns 0 (sets error) */
   4.246 +  uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xffff, SDL_FALSE);
   4.247 +  SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   4.248 +  SDLTest_AssertCheck(
   4.249 +    uresult == 0,
   4.250 +    "Validate result value for parameters(0,0xffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.251 +  lastError = (char *)SDL_GetError();
   4.252 +  SDLTest_AssertPass("SDL_GetError()");
   4.253 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.254 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.255 +             expectedError,
   4.256 +             lastError);
   4.257 +
   4.258 +  /* Clear error messages */
   4.259 +  SDL_ClearError();
   4.260 +  SDLTest_AssertPass("SDL_ClearError()");
   4.261 +
   4.262 +  return TEST_COMPLETED;
   4.263 +}
   4.264 +                              
   4.265 +/*
   4.266 + * @brief Calls to random boundary number generators for Uint32
   4.267 + */
   4.268 +int
   4.269 +sdltest_randomBoundaryNumberUint32(void *arg)
   4.270 +{
   4.271 +  const char *expectedError = "That operation is not supported";
   4.272 +  char *lastError;
   4.273 +  Uint64 uresult;
   4.274 +
   4.275 +  /* Clean error messages */
   4.276 +  SDL_ClearError();
   4.277 +  SDLTest_AssertPass("SDL_ClearError()");
   4.278 +
   4.279 +  /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.280 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 10, SDL_TRUE);
   4.281 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.282 +  SDLTest_AssertCheck(
   4.283 +    uresult == 10,
   4.284 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", uresult);  
   4.285 +
   4.286 +  /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.287 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 11, SDL_TRUE);
   4.288 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.289 +  SDLTest_AssertCheck(
   4.290 +    uresult == 10 || uresult == 11,
   4.291 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", uresult);  
   4.292 +
   4.293 +  /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.294 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 12, SDL_TRUE);
   4.295 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.296 +  SDLTest_AssertCheck(
   4.297 +    uresult == 10 || uresult == 11 || uresult == 12,
   4.298 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", uresult);  
   4.299 +
   4.300 +  /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.301 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 13, SDL_TRUE);
   4.302 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.303 +  SDLTest_AssertCheck(
   4.304 +    uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   4.305 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", uresult);  
   4.306 +
   4.307 +  /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.308 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 20, SDL_TRUE);
   4.309 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.310 +  SDLTest_AssertCheck(
   4.311 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.312 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.313 +
   4.314 +  /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.315 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(20, 10, SDL_TRUE);
   4.316 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.317 +  SDLTest_AssertCheck(
   4.318 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.319 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.320 +
   4.321 +  /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.322 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 20, SDL_FALSE);
   4.323 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.324 +  SDLTest_AssertCheck(
   4.325 +    uresult == 0 || uresult == 21,
   4.326 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", uresult);  
   4.327 +            
   4.328 +  /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   4.329 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 99, SDL_FALSE);
   4.330 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.331 +  SDLTest_AssertCheck(
   4.332 +    uresult == 100,
   4.333 +    "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %lld", uresult);  
   4.334 +
   4.335 +  /* RandomUintXBoundaryValue(1, 0xffffffff, SDL_FALSE) returns 0 (no error) */
   4.336 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 0xffffffff, SDL_FALSE);
   4.337 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.338 +  SDLTest_AssertCheck(
   4.339 +    uresult == 0,
   4.340 +    "Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.341 +  lastError = (char *)SDL_GetError();
   4.342 +  SDLTest_AssertPass("SDL_GetError()");
   4.343 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.344 +
   4.345 +  /* RandomUintXBoundaryValue(0, 0xfffffffe, SDL_FALSE) returns 0xffffffff (no error) */
   4.346 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xfffffffe, SDL_FALSE);
   4.347 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.348 +  SDLTest_AssertCheck(
   4.349 +    uresult == 0xffffffff,
   4.350 +    "Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %lld", uresult);
   4.351 +  lastError = (char *)SDL_GetError();
   4.352 +  SDLTest_AssertPass("SDL_GetError()");
   4.353 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.354 +
   4.355 +  /* RandomUintXBoundaryValue(0, 0xffffffff, SDL_FALSE) returns 0 (sets error) */
   4.356 +  uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xffffffff, SDL_FALSE);
   4.357 +  SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   4.358 +  SDLTest_AssertCheck(
   4.359 +    uresult == 0,
   4.360 +    "Validate result value for parameters(0,0xffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.361 +  lastError = (char *)SDL_GetError();
   4.362 +  SDLTest_AssertPass("SDL_GetError()");
   4.363 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.364 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.365 +             expectedError,
   4.366 +             lastError);
   4.367 +
   4.368 +  /* Clear error messages */
   4.369 +  SDL_ClearError();
   4.370 +  SDLTest_AssertPass("SDL_ClearError()");
   4.371 +
   4.372 +  return TEST_COMPLETED;
   4.373 +}
   4.374 +
   4.375 +/*
   4.376 + * @brief Calls to random boundary number generators for Uint64
   4.377 + */
   4.378 +int
   4.379 +sdltest_randomBoundaryNumberUint64(void *arg)
   4.380 +{
   4.381 +  const char *expectedError = "That operation is not supported";
   4.382 +  char *lastError;
   4.383 +  Uint64 uresult;
   4.384 +
   4.385 +  /* Clean error messages */
   4.386 +  SDL_ClearError();
   4.387 +  SDLTest_AssertPass("SDL_ClearError()");
   4.388 +
   4.389 +  /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.390 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 10, SDL_TRUE);
   4.391 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.392 +  SDLTest_AssertCheck(
   4.393 +    uresult == 10,
   4.394 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", uresult);  
   4.395 +
   4.396 +  /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.397 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 11, SDL_TRUE);
   4.398 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.399 +  SDLTest_AssertCheck(
   4.400 +    uresult == 10 || uresult == 11,
   4.401 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", uresult);  
   4.402 +
   4.403 +  /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.404 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 12, SDL_TRUE);
   4.405 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.406 +  SDLTest_AssertCheck(
   4.407 +    uresult == 10 || uresult == 11 || uresult == 12,
   4.408 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", uresult);  
   4.409 +
   4.410 +  /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.411 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 13, SDL_TRUE);
   4.412 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.413 +  SDLTest_AssertCheck(
   4.414 +    uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   4.415 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", uresult);  
   4.416 +
   4.417 +  /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.418 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 20, SDL_TRUE);
   4.419 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.420 +  SDLTest_AssertCheck(
   4.421 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.422 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.423 +
   4.424 +  /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.425 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(20, 10, SDL_TRUE);
   4.426 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.427 +  SDLTest_AssertCheck(
   4.428 +    uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   4.429 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", uresult);  
   4.430 +
   4.431 +  /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.432 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(1, 20, SDL_FALSE);
   4.433 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.434 +  SDLTest_AssertCheck(
   4.435 +    uresult == 0 || uresult == 21,
   4.436 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", uresult);  
   4.437 +            
   4.438 +  /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   4.439 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, 99, SDL_FALSE);
   4.440 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.441 +  SDLTest_AssertCheck(
   4.442 +    uresult == 100,
   4.443 +    "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %lld", uresult);  
   4.444 +
   4.445 +  /* RandomUintXBoundaryValue(1, 0xffffffffffffffff, SDL_FALSE) returns 0 (no error) */
   4.446 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(1, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
   4.447 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.448 +  SDLTest_AssertCheck(
   4.449 +    uresult == 0,
   4.450 +    "Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.451 +  lastError = (char *)SDL_GetError();
   4.452 +  SDLTest_AssertPass("SDL_GetError()");
   4.453 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.454 +
   4.455 +  /* RandomUintXBoundaryValue(0, 0xfffffffffffffffe, SDL_FALSE) returns 0xffffffffffffffff (no error) */
   4.456 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xfffffffffffffffeULL, SDL_FALSE);
   4.457 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.458 +  SDLTest_AssertCheck(
   4.459 +    uresult == (Uint64)0xffffffffffffffffULL,
   4.460 +    "Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %lld", uresult);
   4.461 +  lastError = (char *)SDL_GetError();
   4.462 +  SDLTest_AssertPass("SDL_GetError()");
   4.463 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.464 +
   4.465 +  /* RandomUintXBoundaryValue(0, 0xffffffffffffffff, SDL_FALSE) returns 0 (sets error) */
   4.466 +  uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
   4.467 +  SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   4.468 +  SDLTest_AssertCheck(
   4.469 +    uresult == 0,
   4.470 +    "Validate result value for parameters(0,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
   4.471 +  lastError = (char *)SDL_GetError();
   4.472 +  SDLTest_AssertPass("SDL_GetError()");
   4.473 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.474 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.475 +             expectedError,
   4.476 +             lastError);
   4.477 +
   4.478 +  /* Clear error messages */
   4.479 +  SDL_ClearError();
   4.480 +  SDLTest_AssertPass("SDL_ClearError()");
   4.481 +
   4.482 +  return TEST_COMPLETED;
   4.483 +}
   4.484 +
   4.485 +/*
   4.486 + * @brief Calls to random boundary number generators for Sint8
   4.487 + */
   4.488 +int
   4.489 +sdltest_randomBoundaryNumberSint8(void *arg)
   4.490 +{
   4.491 +  const char *expectedError = "That operation is not supported";
   4.492 +  char *lastError;
   4.493 +  Sint64 sresult;
   4.494 +
   4.495 +  /* Clean error messages */
   4.496 +  SDL_ClearError();
   4.497 +  SDLTest_AssertPass("SDL_ClearError()");
   4.498 +
   4.499 +  /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.500 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 10, SDL_TRUE);
   4.501 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.502 +  SDLTest_AssertCheck(
   4.503 +    sresult == 10,
   4.504 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", sresult);  
   4.505 +
   4.506 +  /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.507 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 11, SDL_TRUE);
   4.508 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.509 +  SDLTest_AssertCheck(
   4.510 +    sresult == 10 || sresult == 11,
   4.511 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", sresult);  
   4.512 +
   4.513 +  /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.514 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 12, SDL_TRUE);
   4.515 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.516 +  SDLTest_AssertCheck(
   4.517 +    sresult == 10 || sresult == 11 || sresult == 12,
   4.518 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", sresult);  
   4.519 +
   4.520 +  /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.521 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 13, SDL_TRUE);
   4.522 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.523 +  SDLTest_AssertCheck(
   4.524 +    sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   4.525 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", sresult);  
   4.526 +
   4.527 +  /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.528 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 20, SDL_TRUE);
   4.529 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.530 +  SDLTest_AssertCheck(
   4.531 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.532 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.533 +
   4.534 +  /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.535 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(20, 10, SDL_TRUE);
   4.536 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.537 +  SDLTest_AssertCheck(
   4.538 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.539 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.540 +
   4.541 +  /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.542 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(1, 20, SDL_FALSE);
   4.543 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.544 +  SDLTest_AssertCheck(
   4.545 +    sresult == 0 || sresult == 21,
   4.546 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", sresult);  
   4.547 +            
   4.548 +  /* RandomSintXBoundaryValue(SCHAR_MIN, 99, SDL_FALSE) returns 100 */
   4.549 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, 99, SDL_FALSE);
   4.550 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.551 +  SDLTest_AssertCheck(
   4.552 +    sresult == 100,
   4.553 +    "Validate result value for parameters (SCHAR_MIN,99,SDL_FALSE); expected: 100, got: %lld", sresult);  
   4.554 +
   4.555 +  /* RandomSintXBoundaryValue(SCHAR_MIN + 1, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (no error) */
   4.556 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN + 1, SCHAR_MAX, SDL_FALSE);
   4.557 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.558 +  SDLTest_AssertCheck(
   4.559 +    sresult == SCHAR_MIN,
   4.560 +    "Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %lld", SCHAR_MIN, sresult);
   4.561 +  lastError = (char *)SDL_GetError();
   4.562 +  SDLTest_AssertPass("SDL_GetError()");
   4.563 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.564 +
   4.565 +  /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX - 1, SDL_FALSE) returns SCHAR_MAX (no error) */
   4.566 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX -1, SDL_FALSE);
   4.567 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.568 +  SDLTest_AssertCheck(
   4.569 +    sresult == SCHAR_MAX,
   4.570 +    "Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SCHAR_MAX, sresult);
   4.571 +  lastError = (char *)SDL_GetError();
   4.572 +  SDLTest_AssertPass("SDL_GetError()");
   4.573 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.574 +
   4.575 +  /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (sets error) */
   4.576 +  sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE);
   4.577 +  SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   4.578 +  SDLTest_AssertCheck(
   4.579 +    sresult == SCHAR_MIN,
   4.580 +    "Validate result value for parameters(SCHAR_MIN,SCHAR_MAX,SDL_FALSE); expected: %d, got: %lld", SCHAR_MIN, sresult);
   4.581 +  lastError = (char *)SDL_GetError();
   4.582 +  SDLTest_AssertPass("SDL_GetError()");
   4.583 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.584 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.585 +             expectedError,
   4.586 +             lastError);
   4.587 +
   4.588 +  /* Clear error messages */
   4.589 +  SDL_ClearError();
   4.590 +  SDLTest_AssertPass("SDL_ClearError()");
   4.591 +  
   4.592 +  return TEST_COMPLETED;
   4.593 +}
   4.594 +
   4.595 +/*
   4.596 + * @brief Calls to random boundary number generators for Sint16
   4.597 + */
   4.598 +int
   4.599 +sdltest_randomBoundaryNumberSint16(void *arg)
   4.600 +{
   4.601 +  const char *expectedError = "That operation is not supported";
   4.602 +  char *lastError;
   4.603 +  Sint64 sresult;
   4.604 +
   4.605 +  /* Clean error messages */
   4.606 +  SDL_ClearError();
   4.607 +  SDLTest_AssertPass("SDL_ClearError()");
   4.608 +
   4.609 +  /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.610 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 10, SDL_TRUE);
   4.611 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.612 +  SDLTest_AssertCheck(
   4.613 +    sresult == 10,
   4.614 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", sresult);  
   4.615 +
   4.616 +  /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.617 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 11, SDL_TRUE);
   4.618 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.619 +  SDLTest_AssertCheck(
   4.620 +    sresult == 10 || sresult == 11,
   4.621 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", sresult);  
   4.622 +
   4.623 +  /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.624 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 12, SDL_TRUE);
   4.625 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.626 +  SDLTest_AssertCheck(
   4.627 +    sresult == 10 || sresult == 11 || sresult == 12,
   4.628 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", sresult);  
   4.629 +
   4.630 +  /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.631 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 13, SDL_TRUE);
   4.632 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.633 +  SDLTest_AssertCheck(
   4.634 +    sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   4.635 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", sresult);  
   4.636 +
   4.637 +  /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.638 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 20, SDL_TRUE);
   4.639 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.640 +  SDLTest_AssertCheck(
   4.641 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.642 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.643 +
   4.644 +  /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.645 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(20, 10, SDL_TRUE);
   4.646 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.647 +  SDLTest_AssertCheck(
   4.648 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.649 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.650 +
   4.651 +  /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.652 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(1, 20, SDL_FALSE);
   4.653 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.654 +  SDLTest_AssertCheck(
   4.655 +    sresult == 0 || sresult == 21,
   4.656 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", sresult);  
   4.657 +            
   4.658 +  /* RandomSintXBoundaryValue(SHRT_MIN, 99, SDL_FALSE) returns 100 */
   4.659 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, 99, SDL_FALSE);
   4.660 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.661 +  SDLTest_AssertCheck(
   4.662 +    sresult == 100,
   4.663 +    "Validate result value for parameters (SHRT_MIN,99,SDL_FALSE); expected: 100, got: %lld", sresult);  
   4.664 +
   4.665 +  /* RandomSintXBoundaryValue(SHRT_MIN + 1, SHRT_MAX, SDL_FALSE) returns SHRT_MIN (no error) */
   4.666 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN + 1, SHRT_MAX, SDL_FALSE);
   4.667 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.668 +  SDLTest_AssertCheck(
   4.669 +    sresult == SHRT_MIN,
   4.670 +    "Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %lld", SHRT_MIN, sresult);
   4.671 +  lastError = (char *)SDL_GetError();
   4.672 +  SDLTest_AssertPass("SDL_GetError()");
   4.673 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.674 +
   4.675 +  /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE) returns SHRT_MAX (no error) */
   4.676 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE);
   4.677 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.678 +  SDLTest_AssertCheck(
   4.679 +    sresult == SHRT_MAX,
   4.680 +    "Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SHRT_MAX, sresult);
   4.681 +  lastError = (char *)SDL_GetError();
   4.682 +  SDLTest_AssertPass("SDL_GetError()");
   4.683 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.684 +
   4.685 +  /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE) returns 0 (sets error) */
   4.686 +  sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE);
   4.687 +  SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   4.688 +  SDLTest_AssertCheck(
   4.689 +    sresult == SHRT_MIN,
   4.690 +    "Validate result value for parameters(SHRT_MIN,SHRT_MAX,SDL_FALSE); expected: %d, got: %lld", SHRT_MIN, sresult);
   4.691 +  lastError = (char *)SDL_GetError();
   4.692 +  SDLTest_AssertPass("SDL_GetError()");
   4.693 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.694 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.695 +             expectedError,
   4.696 +             lastError);
   4.697 +
   4.698 +  /* Clear error messages */
   4.699 +  SDL_ClearError();
   4.700 +  SDLTest_AssertPass("SDL_ClearError()");
   4.701 +
   4.702 +  return TEST_COMPLETED;
   4.703 +}
   4.704 +                              
   4.705 +/*
   4.706 + * @brief Calls to random boundary number generators for Sint32
   4.707 + */
   4.708 +int
   4.709 +sdltest_randomBoundaryNumberSint32(void *arg)
   4.710 +{
   4.711 +  const char *expectedError = "That operation is not supported";
   4.712 +  char *lastError;
   4.713 +  Sint64 sresult;
   4.714 +
   4.715 +  /* Clean error messages */
   4.716 +  SDL_ClearError();
   4.717 +  SDLTest_AssertPass("SDL_ClearError()");
   4.718 +
   4.719 +  /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.720 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 10, SDL_TRUE);
   4.721 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.722 +  SDLTest_AssertCheck(
   4.723 +    sresult == 10,
   4.724 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", sresult);  
   4.725 +
   4.726 +  /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.727 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 11, SDL_TRUE);
   4.728 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.729 +  SDLTest_AssertCheck(
   4.730 +    sresult == 10 || sresult == 11,
   4.731 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", sresult);  
   4.732 +
   4.733 +  /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.734 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 12, SDL_TRUE);
   4.735 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.736 +  SDLTest_AssertCheck(
   4.737 +    sresult == 10 || sresult == 11 || sresult == 12,
   4.738 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", sresult);  
   4.739 +
   4.740 +  /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.741 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 13, SDL_TRUE);
   4.742 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.743 +  SDLTest_AssertCheck(
   4.744 +    sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   4.745 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", sresult);  
   4.746 +
   4.747 +  /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.748 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 20, SDL_TRUE);
   4.749 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.750 +  SDLTest_AssertCheck(
   4.751 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.752 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.753 +
   4.754 +  /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.755 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(20, 10, SDL_TRUE);
   4.756 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.757 +  SDLTest_AssertCheck(
   4.758 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.759 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.760 +
   4.761 +  /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.762 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(1, 20, SDL_FALSE);
   4.763 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.764 +  SDLTest_AssertCheck(
   4.765 +    sresult == 0 || sresult == 21,
   4.766 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", sresult);  
   4.767 +            
   4.768 +  /* RandomSintXBoundaryValue(LONG_MIN, 99, SDL_FALSE) returns 100 */
   4.769 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(LONG_MIN, 99, SDL_FALSE);
   4.770 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.771 +  SDLTest_AssertCheck(
   4.772 +    sresult == 100,
   4.773 +    "Validate result value for parameters (LONG_MIN,99,SDL_FALSE); expected: 100, got: %lld", sresult);  
   4.774 +
   4.775 +  /* RandomSintXBoundaryValue(LONG_MIN + 1, LONG_MAX, SDL_FALSE) returns LONG_MIN (no error) */
   4.776 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(LONG_MIN + 1, LONG_MAX, SDL_FALSE);
   4.777 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.778 +  SDLTest_AssertCheck(
   4.779 +    sresult == LONG_MIN,
   4.780 +    "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %lld", LONG_MIN, sresult);
   4.781 +  lastError = (char *)SDL_GetError();
   4.782 +  SDLTest_AssertPass("SDL_GetError()");
   4.783 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.784 +
   4.785 +  /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE) returns LONG_MAX (no error) */
   4.786 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE);
   4.787 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.788 +  SDLTest_AssertCheck(
   4.789 +    sresult == LONG_MAX,
   4.790 +    "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %lld", LONG_MAX, sresult);
   4.791 +  lastError = (char *)SDL_GetError();
   4.792 +  SDLTest_AssertPass("SDL_GetError()");
   4.793 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.794 +
   4.795 +  /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE) returns 0 (sets error) */
   4.796 +  sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE);
   4.797 +  SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   4.798 +  SDLTest_AssertCheck(
   4.799 +    sresult == LONG_MIN,
   4.800 +    "Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %d, got: %lld", LONG_MIN, sresult);
   4.801 +  lastError = (char *)SDL_GetError();
   4.802 +  SDLTest_AssertPass("SDL_GetError()");
   4.803 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.804 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.805 +             expectedError,
   4.806 +             lastError);
   4.807 +
   4.808 +  /* Clear error messages */
   4.809 +  SDL_ClearError();
   4.810 +  SDLTest_AssertPass("SDL_ClearError()");
   4.811 +
   4.812 +  return TEST_COMPLETED;
   4.813 +}
   4.814 +
   4.815 +/*
   4.816 + * @brief Calls to random boundary number generators for Sint64
   4.817 + */
   4.818 +int
   4.819 +sdltest_randomBoundaryNumberSint64(void *arg)
   4.820 +{
   4.821 +  const char *expectedError = "That operation is not supported";
   4.822 +  char *lastError;
   4.823 +  Sint64 sresult;
   4.824 +
   4.825 +  /* Clean error messages */
   4.826 +  SDL_ClearError();
   4.827 +  SDLTest_AssertPass("SDL_ClearError()");
   4.828 +
   4.829 +  /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   4.830 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 10, SDL_TRUE);
   4.831 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.832 +  SDLTest_AssertCheck(
   4.833 +    sresult == 10,
   4.834 +    "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %lld", sresult);  
   4.835 +
   4.836 +  /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   4.837 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 11, SDL_TRUE);
   4.838 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.839 +  SDLTest_AssertCheck(
   4.840 +    sresult == 10 || sresult == 11,
   4.841 +    "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %lld", sresult);  
   4.842 +
   4.843 +  /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   4.844 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 12, SDL_TRUE);
   4.845 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.846 +  SDLTest_AssertCheck(
   4.847 +    sresult == 10 || sresult == 11 || sresult == 12,
   4.848 +    "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %lld", sresult);  
   4.849 +
   4.850 +  /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   4.851 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 13, SDL_TRUE);
   4.852 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.853 +  SDLTest_AssertCheck(
   4.854 +    sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   4.855 +    "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %lld", sresult);  
   4.856 +
   4.857 +  /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.858 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 20, SDL_TRUE);
   4.859 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.860 +  SDLTest_AssertCheck(
   4.861 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.862 +    "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.863 +
   4.864 +  /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   4.865 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(20, 10, SDL_TRUE);
   4.866 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.867 +  SDLTest_AssertCheck(
   4.868 +    sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   4.869 +    "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %lld", sresult);  
   4.870 +
   4.871 +  /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   4.872 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(1, 20, SDL_FALSE);
   4.873 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.874 +  SDLTest_AssertCheck(
   4.875 +    sresult == 0 || sresult == 21,
   4.876 +    "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %lld", sresult);  
   4.877 +            
   4.878 +  /* RandomSintXBoundaryValue(LLONG_MIN, 99, SDL_FALSE) returns 100 */
   4.879 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, 99, SDL_FALSE);
   4.880 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.881 +  SDLTest_AssertCheck(
   4.882 +    sresult == 100,
   4.883 +    "Validate result value for parameters (LLONG_MIN,99,SDL_FALSE); expected: 100, got: %lld", sresult);  
   4.884 +
   4.885 +  /* RandomSintXBoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE) returns LLONG_MIN (no error) */
   4.886 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE);
   4.887 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.888 +  SDLTest_AssertCheck(
   4.889 +    sresult == LLONG_MIN,
   4.890 +    "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %lld, got: %lld", LLONG_MIN, sresult);
   4.891 +  lastError = (char *)SDL_GetError();
   4.892 +  SDLTest_AssertPass("SDL_GetError()");
   4.893 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.894 +
   4.895 +  /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */
   4.896 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE);
   4.897 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.898 +  SDLTest_AssertCheck(
   4.899 +    sresult == LLONG_MAX,
   4.900 +    "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %lld, got: %lld", LLONG_MAX, sresult);
   4.901 +  lastError = (char *)SDL_GetError();
   4.902 +  SDLTest_AssertPass("SDL_GetError()");
   4.903 +  SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
   4.904 +
   4.905 +  /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */
   4.906 +  sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE);
   4.907 +  SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   4.908 +  SDLTest_AssertCheck(
   4.909 +    sresult == LLONG_MIN,
   4.910 +    "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %lld, got: %lld", LLONG_MIN, sresult);
   4.911 +  lastError = (char *)SDL_GetError();
   4.912 +  SDLTest_AssertPass("SDL_GetError()");
   4.913 +  SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   4.914 +             "SDL_GetError(): expected message '%s', was message: '%s'",
   4.915 +             expectedError,
   4.916 +             lastError);
   4.917 +
   4.918 +  /* Clear error messages */
   4.919 +  SDL_ClearError();
   4.920 +  SDLTest_AssertPass("SDL_ClearError()");
   4.921 +
   4.922 +  return TEST_COMPLETED;
   4.923 +}
   4.924 +
   4.925 +
   4.926  /* ================= Test References ================== */
   4.927  
   4.928  /* SDL_test test cases */
   4.929 @@ -124,9 +994,34 @@
   4.930  static const SDLTest_TestCaseReference sdltestTest2 =
   4.931  		{ (SDLTest_TestCaseFp)sdltest_randomNumber, "sdltest_randomNumber", "Calls to random number generators", TEST_ENABLED };
   4.932  
   4.933 +static const SDLTest_TestCaseReference sdltestTest3 =
   4.934 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint8, "sdltest_randomBoundaryNumberUint8", "Calls to random boundary number generators for Uint8", TEST_ENABLED };
   4.935 +
   4.936 +static const SDLTest_TestCaseReference sdltestTest4 =
   4.937 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint16, "sdltest_randomBoundaryNumberUint16", "Calls to random boundary number generators for Uint16", TEST_ENABLED };
   4.938 +
   4.939 +static const SDLTest_TestCaseReference sdltestTest5 =
   4.940 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint32, "sdltest_randomBoundaryNumberUint32", "Calls to random boundary number generators for Uint32", TEST_ENABLED };
   4.941 +
   4.942 +static const SDLTest_TestCaseReference sdltestTest6 =
   4.943 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint64, "sdltest_randomBoundaryNumberUint64", "Calls to random boundary number generators for Uint64", TEST_ENABLED };
   4.944 +
   4.945 +static const SDLTest_TestCaseReference sdltestTest7 =
   4.946 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint8, "sdltest_randomBoundaryNumberSint8", "Calls to random boundary number generators for Sint8", TEST_ENABLED };
   4.947 +
   4.948 +static const SDLTest_TestCaseReference sdltestTest8 =
   4.949 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint16, "sdltest_randomBoundaryNumberSint16", "Calls to random boundary number generators for Sint16", TEST_ENABLED };
   4.950 +
   4.951 +static const SDLTest_TestCaseReference sdltestTest9 =
   4.952 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint32, "sdltest_randomBoundaryNumberSint32", "Calls to random boundary number generators for Sint32", TEST_ENABLED };
   4.953 +
   4.954 +static const SDLTest_TestCaseReference sdltestTest10 =
   4.955 +		{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint64, "sdltest_randomBoundaryNumberSint64", "Calls to random boundary number generators for Sint64", TEST_ENABLED };
   4.956 +
   4.957  /* Sequence of SDL_test test cases */
   4.958  static const SDLTest_TestCaseReference *sdltestTests[] =  {
   4.959 -	&sdltestTest1, &sdltestTest2, NULL
   4.960 +	&sdltestTest1, &sdltestTest2, &sdltestTest3, &sdltestTest4, &sdltestTest5, &sdltestTest6,
   4.961 +	&sdltestTest7, &sdltestTest8, &sdltestTest9, &sdltestTest10, NULL
   4.962  };
   4.963  
   4.964  /* SDL_test test suite (global) */