test/testautomation_sdltest.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 07 Dec 2017 16:08:09 -0800
changeset 11730 ac6c607e065c
parent 11420 f1dcaee3479b
child 13693 d075df3ffa57
permissions -rw-r--r--
Enable building the Metal renderer by default, and weak link the Metal framework so the SDL library is safe to use on older Macs
Also generate iOS versions of the Metal shaders
     1 /**
     2  * SDL_test test suite
     3  */
     4 
     5 #include <limits.h>
     6 /* Visual Studio 2008 doesn't have stdint.h */
     7 #if defined(_MSC_VER) && _MSC_VER <= 1500
     8 #define UINT8_MAX   _UI8_MAX
     9 #define UINT16_MAX  _UI16_MAX
    10 #define UINT32_MAX  _UI32_MAX
    11 #define INT64_MIN    _I64_MIN
    12 #define INT64_MAX    _I64_MAX
    13 #define UINT64_MAX  _UI64_MAX
    14 #else
    15 #include <stdint.h>
    16 #endif
    17 
    18 #include <stdio.h>
    19 #include <float.h>
    20 #include <ctype.h>
    21 
    22 #include "SDL.h"
    23 #include "SDL_test.h"
    24 
    25 /* Test case functions */
    26 
    27 /* Forward declarations for internal harness functions */
    28 extern char *SDLTest_GenerateRunSeed(const int length);
    29 
    30 /**
    31  * @brief Calls to SDLTest_GenerateRunSeed()
    32  */
    33 int
    34 sdltest_generateRunSeed(void *arg)
    35 {
    36   char* result;
    37   size_t i, l;
    38   int j;
    39   
    40   for (i = 1; i <= 10; i += 3) {   
    41      result = SDLTest_GenerateRunSeed((const int)i);
    42      SDLTest_AssertPass("Call to SDLTest_GenerateRunSeed()");
    43      SDLTest_AssertCheck(result != NULL, "Verify returned value is not NULL");
    44      if (result != NULL) {
    45        l = SDL_strlen(result);
    46        SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", (int) i, (int) l);
    47        SDL_free(result);
    48      }
    49   }
    50 
    51   /* Negative cases */
    52   for (j = -2; j <= 0; j++) {
    53      result = SDLTest_GenerateRunSeed((const int)j);
    54      SDLTest_AssertPass("Call to SDLTest_GenerateRunSeed()");
    55      SDLTest_AssertCheck(result == NULL, "Verify returned value is not NULL");
    56   }
    57   
    58   return TEST_COMPLETED;
    59 }
    60 
    61 /**
    62  * @brief Calls to SDLTest_GetFuzzerInvocationCount()
    63  */
    64 int
    65 sdltest_getFuzzerInvocationCount(void *arg)
    66 {
    67   Uint8 result;
    68   int fuzzerCount1, fuzzerCount2;
    69 
    70   fuzzerCount1 = SDLTest_GetFuzzerInvocationCount();
    71   SDLTest_AssertPass("Call to SDLTest_GetFuzzerInvocationCount()");
    72   SDLTest_AssertCheck(fuzzerCount1 >= 0, "Verify returned value, expected: >=0, got: %d", fuzzerCount1);
    73 
    74   result = SDLTest_RandomUint8();
    75   SDLTest_AssertPass("Call to SDLTest_RandomUint8(), returned %d", result);
    76 
    77   fuzzerCount2 = SDLTest_GetFuzzerInvocationCount();
    78   SDLTest_AssertPass("Call to SDLTest_GetFuzzerInvocationCount()");
    79   SDLTest_AssertCheck(fuzzerCount2 > fuzzerCount1, "Verify returned value, expected: >%d, got: %d", fuzzerCount1, fuzzerCount2);
    80 
    81   return TEST_COMPLETED;
    82 }
    83 
    84 
    85 /**
    86  * @brief Calls to random number generators
    87  */
    88 int
    89 sdltest_randomNumber(void *arg)
    90 {
    91   Sint64 result;
    92   Uint64 uresult;
    93   double dresult;
    94   Uint64 umax;
    95   Sint64 min, max;
    96 
    97   result = (Sint64)SDLTest_RandomUint8();
    98   umax = (1 << 8) - 1;
    99   SDLTest_AssertPass("Call to SDLTest_RandomUint8");
   100   SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%"SDL_PRIu64"], got: %"SDL_PRIs64, umax, result);
   101 
   102   result = (Sint64)SDLTest_RandomSint8();
   103   min = 0 - (1 << 7);
   104   max =     (1 << 7) - 1;
   105   SDLTest_AssertPass("Call to SDLTest_RandomSint8");
   106   SDLTest_AssertCheck(result >= min && result <= max, "Verify result value, expected: [%"SDL_PRIs64",%"SDL_PRIs64"], got: %"SDL_PRIs64, min, max, result);
   107 
   108   result = (Sint64)SDLTest_RandomUint16();
   109   umax = (1 << 16) - 1;
   110   SDLTest_AssertPass("Call to SDLTest_RandomUint16");
   111   SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%"SDL_PRIu64"], got: %"SDL_PRIs64, umax, result);
   112 
   113   result = (Sint64)SDLTest_RandomSint16();
   114   min = 0 - (1 << 15);
   115   max =     (1 << 15) - 1;
   116   SDLTest_AssertPass("Call to SDLTest_RandomSint16");
   117   SDLTest_AssertCheck(result >= min && result <= max, "Verify result value, expected: [%"SDL_PRIs64",%"SDL_PRIs64"], got: %"SDL_PRIs64, min, max, result);
   118 
   119   result = (Sint64)SDLTest_RandomUint32();
   120   umax = ((Uint64)1 << 32) - 1;
   121   SDLTest_AssertPass("Call to SDLTest_RandomUint32");
   122   SDLTest_AssertCheck(result >= 0 && result <= (Sint64)umax, "Verify result value, expected: [0,%"SDL_PRIu64"], got: %"SDL_PRIs64, umax, result);
   123 
   124   result = (Sint64)SDLTest_RandomSint32();
   125   min = 0 - ((Sint64)1 << 31);
   126   max =     ((Sint64)1 << 31) - 1;
   127   SDLTest_AssertPass("Call to SDLTest_RandomSint32");
   128   SDLTest_AssertCheck(result >= min && result <= max, "Verify result value, expected: [%"SDL_PRIs64",%"SDL_PRIs64"], got: %"SDL_PRIs64, min, max, result);
   129 
   130   uresult = SDLTest_RandomUint64();
   131   SDLTest_AssertPass("Call to SDLTest_RandomUint64");
   132 
   133   result = SDLTest_RandomSint64();
   134   SDLTest_AssertPass("Call to SDLTest_RandomSint64");
   135 
   136   dresult = (double)SDLTest_RandomUnitFloat();
   137   SDLTest_AssertPass("Call to SDLTest_RandomUnitFloat");
   138   SDLTest_AssertCheck(dresult >= 0.0 && dresult < 1.0, "Verify result value, expected: [0.0,1.0[, got: %e", dresult);
   139 
   140   dresult = (double)SDLTest_RandomFloat();
   141   SDLTest_AssertPass("Call to SDLTest_RandomFloat");
   142   SDLTest_AssertCheck(dresult >= (double)(-FLT_MAX) && dresult <= (double)FLT_MAX, "Verify result value, expected: [%e,%e], got: %e", (double)(-FLT_MAX), (double)FLT_MAX, dresult);
   143 
   144   dresult = (double)SDLTest_RandomUnitDouble();
   145   SDLTest_AssertPass("Call to SDLTest_RandomUnitDouble");
   146   SDLTest_AssertCheck(dresult >= 0.0 && dresult < 1.0, "Verify result value, expected: [0.0,1.0[, got: %e", dresult);
   147 
   148   dresult = SDLTest_RandomDouble();
   149   SDLTest_AssertPass("Call to SDLTest_RandomDouble");
   150 
   151   return TEST_COMPLETED;
   152 }
   153 
   154 /*
   155  * @brief Calls to random boundary number generators for Uint8
   156  */
   157 int
   158 sdltest_randomBoundaryNumberUint8(void *arg)
   159 {
   160   const char *expectedError = "That operation is not supported";
   161   char *lastError;
   162   Uint64 uresult;
   163 
   164   /* Clean error messages */
   165   SDL_ClearError();
   166   SDLTest_AssertPass("SDL_ClearError()");
   167 
   168   /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   169   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 10, SDL_TRUE);
   170   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   171   SDLTest_AssertCheck(
   172     uresult == 10,
   173     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, uresult);
   174 
   175   /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   176   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 11, SDL_TRUE);
   177   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   178   SDLTest_AssertCheck(
   179     uresult == 10 || uresult == 11,
   180     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, uresult);
   181 
   182   /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   183   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 12, SDL_TRUE);
   184   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   185   SDLTest_AssertCheck(
   186     uresult == 10 || uresult == 11 || uresult == 12,
   187     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, uresult);
   188 
   189   /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   190   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 13, SDL_TRUE);
   191   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   192   SDLTest_AssertCheck(
   193     uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   194     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, uresult);
   195 
   196   /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   197   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(10, 20, SDL_TRUE);
   198   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   199   SDLTest_AssertCheck(
   200     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   201     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   202 
   203   /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   204   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(20, 10, SDL_TRUE);
   205   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   206   SDLTest_AssertCheck(
   207     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   208     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   209 
   210   /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   211   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 20, SDL_FALSE);
   212   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   213   SDLTest_AssertCheck(
   214     uresult == 0 || uresult == 21,
   215     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, uresult);
   216 
   217   /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   218   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 99, SDL_FALSE);
   219   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   220   SDLTest_AssertCheck(
   221     uresult == 100,
   222     "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, uresult);
   223 
   224   /* RandomUintXBoundaryValue(1, 0xff, SDL_FALSE) returns 0 (no error) */
   225   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(1, 255, SDL_FALSE);
   226   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   227   SDLTest_AssertCheck(
   228     uresult == 0,
   229     "Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   230   lastError = (char *)SDL_GetError();
   231   SDLTest_AssertPass("SDL_GetError()");
   232   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   233 
   234   /* RandomUintXBoundaryValue(0, 0xfe, SDL_FALSE) returns 0xff (no error) */
   235   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 254, SDL_FALSE);
   236   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   237   SDLTest_AssertCheck(
   238     uresult == 0xff,
   239     "Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %"SDL_PRIs64, uresult);
   240   lastError = (char *)SDL_GetError();
   241   SDLTest_AssertPass("SDL_GetError()");
   242   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   243 
   244   /* RandomUintXBoundaryValue(0, 0xff, SDL_FALSE) returns 0 (sets error) */
   245   uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 255, SDL_FALSE);
   246   SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
   247   SDLTest_AssertCheck(
   248     uresult == 0,
   249     "Validate result value for parameters(0,255,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   250   lastError = (char *)SDL_GetError();
   251   SDLTest_AssertPass("SDL_GetError()");
   252   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   253              "SDL_GetError(): expected message '%s', was message: '%s'",
   254              expectedError,
   255              lastError);
   256 
   257   /* Clear error messages */
   258   SDL_ClearError();
   259   SDLTest_AssertPass("SDL_ClearError()");
   260 
   261   return TEST_COMPLETED;
   262 }
   263 
   264 /*
   265  * @brief Calls to random boundary number generators for Uint16
   266  */
   267 int
   268 sdltest_randomBoundaryNumberUint16(void *arg)
   269 {
   270   const char *expectedError = "That operation is not supported";
   271   char *lastError;
   272   Uint64 uresult;
   273 
   274   /* Clean error messages */
   275   SDL_ClearError();
   276   SDLTest_AssertPass("SDL_ClearError()");
   277 
   278   /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   279   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 10, SDL_TRUE);
   280   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   281   SDLTest_AssertCheck(
   282     uresult == 10,
   283     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, uresult);
   284 
   285   /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   286   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 11, SDL_TRUE);
   287   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   288   SDLTest_AssertCheck(
   289     uresult == 10 || uresult == 11,
   290     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, uresult);
   291 
   292   /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   293   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 12, SDL_TRUE);
   294   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   295   SDLTest_AssertCheck(
   296     uresult == 10 || uresult == 11 || uresult == 12,
   297     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, uresult);
   298 
   299   /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   300   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 13, SDL_TRUE);
   301   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   302   SDLTest_AssertCheck(
   303     uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   304     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, uresult);
   305 
   306   /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   307   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(10, 20, SDL_TRUE);
   308   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   309   SDLTest_AssertCheck(
   310     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   311     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   312 
   313   /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   314   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(20, 10, SDL_TRUE);
   315   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   316   SDLTest_AssertCheck(
   317     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   318     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   319 
   320   /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   321   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 20, SDL_FALSE);
   322   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   323   SDLTest_AssertCheck(
   324     uresult == 0 || uresult == 21,
   325     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, uresult);
   326 
   327   /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   328   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 99, SDL_FALSE);
   329   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   330   SDLTest_AssertCheck(
   331     uresult == 100,
   332     "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, uresult);
   333 
   334   /* RandomUintXBoundaryValue(1, 0xffff, SDL_FALSE) returns 0 (no error) */
   335   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(1, 0xffff, SDL_FALSE);
   336   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   337   SDLTest_AssertCheck(
   338     uresult == 0,
   339     "Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   340   lastError = (char *)SDL_GetError();
   341   SDLTest_AssertPass("SDL_GetError()");
   342   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   343 
   344   /* RandomUintXBoundaryValue(0, 0xfffe, SDL_FALSE) returns 0xffff (no error) */
   345   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xfffe, SDL_FALSE);
   346   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   347   SDLTest_AssertCheck(
   348     uresult == 0xffff,
   349     "Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %"SDL_PRIs64, uresult);
   350   lastError = (char *)SDL_GetError();
   351   SDLTest_AssertPass("SDL_GetError()");
   352   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   353 
   354   /* RandomUintXBoundaryValue(0, 0xffff, SDL_FALSE) returns 0 (sets error) */
   355   uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xffff, SDL_FALSE);
   356   SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
   357   SDLTest_AssertCheck(
   358     uresult == 0,
   359     "Validate result value for parameters(0,0xffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   360   lastError = (char *)SDL_GetError();
   361   SDLTest_AssertPass("SDL_GetError()");
   362   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   363              "SDL_GetError(): expected message '%s', was message: '%s'",
   364              expectedError,
   365              lastError);
   366 
   367   /* Clear error messages */
   368   SDL_ClearError();
   369   SDLTest_AssertPass("SDL_ClearError()");
   370 
   371   return TEST_COMPLETED;
   372 }
   373 
   374 /*
   375  * @brief Calls to random boundary number generators for Uint32
   376  */
   377 int
   378 sdltest_randomBoundaryNumberUint32(void *arg)
   379 {
   380   const char *expectedError = "That operation is not supported";
   381   char *lastError;
   382   Uint64 uresult;
   383 
   384   /* Clean error messages */
   385   SDL_ClearError();
   386   SDLTest_AssertPass("SDL_ClearError()");
   387 
   388   /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   389   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 10, SDL_TRUE);
   390   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   391   SDLTest_AssertCheck(
   392     uresult == 10,
   393     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, uresult);
   394 
   395   /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   396   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 11, SDL_TRUE);
   397   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   398   SDLTest_AssertCheck(
   399     uresult == 10 || uresult == 11,
   400     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, uresult);
   401 
   402   /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   403   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 12, SDL_TRUE);
   404   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   405   SDLTest_AssertCheck(
   406     uresult == 10 || uresult == 11 || uresult == 12,
   407     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, uresult);
   408 
   409   /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   410   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 13, SDL_TRUE);
   411   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   412   SDLTest_AssertCheck(
   413     uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   414     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, uresult);
   415 
   416   /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   417   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(10, 20, SDL_TRUE);
   418   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   419   SDLTest_AssertCheck(
   420     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   421     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   422 
   423   /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   424   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(20, 10, SDL_TRUE);
   425   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   426   SDLTest_AssertCheck(
   427     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   428     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   429 
   430   /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   431   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 20, SDL_FALSE);
   432   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   433   SDLTest_AssertCheck(
   434     uresult == 0 || uresult == 21,
   435     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, uresult);
   436 
   437   /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   438   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 99, SDL_FALSE);
   439   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   440   SDLTest_AssertCheck(
   441     uresult == 100,
   442     "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, uresult);
   443 
   444   /* RandomUintXBoundaryValue(1, 0xffffffff, SDL_FALSE) returns 0 (no error) */
   445   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(1, 0xffffffff, SDL_FALSE);
   446   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   447   SDLTest_AssertCheck(
   448     uresult == 0,
   449     "Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   450   lastError = (char *)SDL_GetError();
   451   SDLTest_AssertPass("SDL_GetError()");
   452   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   453 
   454   /* RandomUintXBoundaryValue(0, 0xfffffffe, SDL_FALSE) returns 0xffffffff (no error) */
   455   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xfffffffe, SDL_FALSE);
   456   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   457   SDLTest_AssertCheck(
   458     uresult == 0xffffffff,
   459     "Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %"SDL_PRIs64, uresult);
   460   lastError = (char *)SDL_GetError();
   461   SDLTest_AssertPass("SDL_GetError()");
   462   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   463 
   464   /* RandomUintXBoundaryValue(0, 0xffffffff, SDL_FALSE) returns 0 (sets error) */
   465   uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xffffffff, SDL_FALSE);
   466   SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
   467   SDLTest_AssertCheck(
   468     uresult == 0,
   469     "Validate result value for parameters(0,0xffffffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   470   lastError = (char *)SDL_GetError();
   471   SDLTest_AssertPass("SDL_GetError()");
   472   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   473              "SDL_GetError(): expected message '%s', was message: '%s'",
   474              expectedError,
   475              lastError);
   476 
   477   /* Clear error messages */
   478   SDL_ClearError();
   479   SDLTest_AssertPass("SDL_ClearError()");
   480 
   481   return TEST_COMPLETED;
   482 }
   483 
   484 /*
   485  * @brief Calls to random boundary number generators for Uint64
   486  */
   487 int
   488 sdltest_randomBoundaryNumberUint64(void *arg)
   489 {
   490   const char *expectedError = "That operation is not supported";
   491   char *lastError;
   492   Uint64 uresult;
   493 
   494   /* Clean error messages */
   495   SDL_ClearError();
   496   SDLTest_AssertPass("SDL_ClearError()");
   497 
   498   /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   499   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 10, SDL_TRUE);
   500   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   501   SDLTest_AssertCheck(
   502     uresult == 10,
   503     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, uresult);
   504 
   505   /* RandomUintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   506   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 11, SDL_TRUE);
   507   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   508   SDLTest_AssertCheck(
   509     uresult == 10 || uresult == 11,
   510     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, uresult);
   511 
   512   /* RandomUintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   513   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 12, SDL_TRUE);
   514   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   515   SDLTest_AssertCheck(
   516     uresult == 10 || uresult == 11 || uresult == 12,
   517     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, uresult);
   518 
   519   /* RandomUintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   520   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 13, SDL_TRUE);
   521   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   522   SDLTest_AssertCheck(
   523     uresult == 10 || uresult == 11 || uresult == 12 || uresult == 13,
   524     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, uresult);
   525 
   526   /* RandomUintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   527   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(10, 20, SDL_TRUE);
   528   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   529   SDLTest_AssertCheck(
   530     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   531     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   532 
   533   /* RandomUintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   534   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(20, 10, SDL_TRUE);
   535   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   536   SDLTest_AssertCheck(
   537     uresult == 10 || uresult == 11 || uresult == 19 || uresult == 20,
   538     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, uresult);
   539 
   540   /* RandomUintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   541   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(1, 20, SDL_FALSE);
   542   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   543   SDLTest_AssertCheck(
   544     uresult == 0 || uresult == 21,
   545     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, uresult);
   546 
   547   /* RandomUintXBoundaryValue(0, 99, SDL_FALSE) returns 100 */
   548   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, 99, SDL_FALSE);
   549   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   550   SDLTest_AssertCheck(
   551     uresult == 100,
   552     "Validate result value for parameters (0,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, uresult);
   553 
   554   /* RandomUintXBoundaryValue(1, 0xffffffffffffffff, SDL_FALSE) returns 0 (no error) */
   555   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(1, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
   556   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   557   SDLTest_AssertCheck(
   558     uresult == 0,
   559     "Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   560   lastError = (char *)SDL_GetError();
   561   SDLTest_AssertPass("SDL_GetError()");
   562   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   563 
   564   /* RandomUintXBoundaryValue(0, 0xfffffffffffffffe, SDL_FALSE) returns 0xffffffffffffffff (no error) */
   565   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xfffffffffffffffeULL, SDL_FALSE);
   566   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   567   SDLTest_AssertCheck(
   568     uresult == (Uint64)0xffffffffffffffffULL,
   569     "Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %"SDL_PRIs64, uresult);
   570   lastError = (char *)SDL_GetError();
   571   SDLTest_AssertPass("SDL_GetError()");
   572   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   573 
   574   /* RandomUintXBoundaryValue(0, 0xffffffffffffffff, SDL_FALSE) returns 0 (sets error) */
   575   uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
   576   SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
   577   SDLTest_AssertCheck(
   578     uresult == 0,
   579     "Validate result value for parameters(0,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %"SDL_PRIs64, uresult);
   580   lastError = (char *)SDL_GetError();
   581   SDLTest_AssertPass("SDL_GetError()");
   582   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   583              "SDL_GetError(): expected message '%s', was message: '%s'",
   584              expectedError,
   585              lastError);
   586 
   587   /* Clear error messages */
   588   SDL_ClearError();
   589   SDLTest_AssertPass("SDL_ClearError()");
   590 
   591   return TEST_COMPLETED;
   592 }
   593 
   594 /*
   595  * @brief Calls to random boundary number generators for Sint8
   596  */
   597 int
   598 sdltest_randomBoundaryNumberSint8(void *arg)
   599 {
   600   const char *expectedError = "That operation is not supported";
   601   char *lastError;
   602   Sint64 sresult;
   603 
   604   /* Clean error messages */
   605   SDL_ClearError();
   606   SDLTest_AssertPass("SDL_ClearError()");
   607 
   608   /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   609   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 10, SDL_TRUE);
   610   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   611   SDLTest_AssertCheck(
   612     sresult == 10,
   613     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, sresult);
   614 
   615   /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   616   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 11, SDL_TRUE);
   617   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   618   SDLTest_AssertCheck(
   619     sresult == 10 || sresult == 11,
   620     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, sresult);
   621 
   622   /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   623   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 12, SDL_TRUE);
   624   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   625   SDLTest_AssertCheck(
   626     sresult == 10 || sresult == 11 || sresult == 12,
   627     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, sresult);
   628 
   629   /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   630   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 13, SDL_TRUE);
   631   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   632   SDLTest_AssertCheck(
   633     sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   634     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, sresult);
   635 
   636   /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   637   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(10, 20, SDL_TRUE);
   638   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   639   SDLTest_AssertCheck(
   640     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   641     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   642 
   643   /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   644   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(20, 10, SDL_TRUE);
   645   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   646   SDLTest_AssertCheck(
   647     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   648     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   649 
   650   /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   651   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(1, 20, SDL_FALSE);
   652   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   653   SDLTest_AssertCheck(
   654     sresult == 0 || sresult == 21,
   655     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult);
   656 
   657   /* RandomSintXBoundaryValue(SCHAR_MIN, 99, SDL_FALSE) returns 100 */
   658   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, 99, SDL_FALSE);
   659   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   660   SDLTest_AssertCheck(
   661     sresult == 100,
   662     "Validate result value for parameters (SCHAR_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult);
   663 
   664   /* RandomSintXBoundaryValue(SCHAR_MIN + 1, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (no error) */
   665   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN + 1, SCHAR_MAX, SDL_FALSE);
   666   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   667   SDLTest_AssertCheck(
   668     sresult == SCHAR_MIN,
   669     "Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SCHAR_MIN, sresult);
   670   lastError = (char *)SDL_GetError();
   671   SDLTest_AssertPass("SDL_GetError()");
   672   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   673 
   674   /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX - 1, SDL_FALSE) returns SCHAR_MAX (no error) */
   675   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX -1, SDL_FALSE);
   676   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   677   SDLTest_AssertCheck(
   678     sresult == SCHAR_MAX,
   679     "Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SCHAR_MAX, sresult);
   680   lastError = (char *)SDL_GetError();
   681   SDLTest_AssertPass("SDL_GetError()");
   682   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   683 
   684   /* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (sets error) */
   685   sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE);
   686   SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
   687   SDLTest_AssertCheck(
   688     sresult == SCHAR_MIN,
   689     "Validate result value for parameters(SCHAR_MIN,SCHAR_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SCHAR_MIN, sresult);
   690   lastError = (char *)SDL_GetError();
   691   SDLTest_AssertPass("SDL_GetError()");
   692   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   693              "SDL_GetError(): expected message '%s', was message: '%s'",
   694              expectedError,
   695              lastError);
   696 
   697   /* Clear error messages */
   698   SDL_ClearError();
   699   SDLTest_AssertPass("SDL_ClearError()");
   700 
   701   return TEST_COMPLETED;
   702 }
   703 
   704 /*
   705  * @brief Calls to random boundary number generators for Sint16
   706  */
   707 int
   708 sdltest_randomBoundaryNumberSint16(void *arg)
   709 {
   710   const char *expectedError = "That operation is not supported";
   711   char *lastError;
   712   Sint64 sresult;
   713 
   714   /* Clean error messages */
   715   SDL_ClearError();
   716   SDLTest_AssertPass("SDL_ClearError()");
   717 
   718   /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   719   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 10, SDL_TRUE);
   720   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   721   SDLTest_AssertCheck(
   722     sresult == 10,
   723     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, sresult);
   724 
   725   /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   726   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 11, SDL_TRUE);
   727   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   728   SDLTest_AssertCheck(
   729     sresult == 10 || sresult == 11,
   730     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, sresult);
   731 
   732   /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   733   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 12, SDL_TRUE);
   734   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   735   SDLTest_AssertCheck(
   736     sresult == 10 || sresult == 11 || sresult == 12,
   737     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, sresult);
   738 
   739   /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   740   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 13, SDL_TRUE);
   741   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   742   SDLTest_AssertCheck(
   743     sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   744     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, sresult);
   745 
   746   /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   747   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(10, 20, SDL_TRUE);
   748   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   749   SDLTest_AssertCheck(
   750     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   751     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   752 
   753   /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   754   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(20, 10, SDL_TRUE);
   755   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   756   SDLTest_AssertCheck(
   757     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   758     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   759 
   760   /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   761   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(1, 20, SDL_FALSE);
   762   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   763   SDLTest_AssertCheck(
   764     sresult == 0 || sresult == 21,
   765     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult);
   766 
   767   /* RandomSintXBoundaryValue(SHRT_MIN, 99, SDL_FALSE) returns 100 */
   768   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, 99, SDL_FALSE);
   769   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   770   SDLTest_AssertCheck(
   771     sresult == 100,
   772     "Validate result value for parameters (SHRT_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult);
   773 
   774   /* RandomSintXBoundaryValue(SHRT_MIN + 1, SHRT_MAX, SDL_FALSE) returns SHRT_MIN (no error) */
   775   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN + 1, SHRT_MAX, SDL_FALSE);
   776   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   777   SDLTest_AssertCheck(
   778     sresult == SHRT_MIN,
   779     "Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SHRT_MIN, sresult);
   780   lastError = (char *)SDL_GetError();
   781   SDLTest_AssertPass("SDL_GetError()");
   782   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   783 
   784   /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE) returns SHRT_MAX (no error) */
   785   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE);
   786   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   787   SDLTest_AssertCheck(
   788     sresult == SHRT_MAX,
   789     "Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SHRT_MAX, sresult);
   790   lastError = (char *)SDL_GetError();
   791   SDLTest_AssertPass("SDL_GetError()");
   792   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   793 
   794   /* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE) returns 0 (sets error) */
   795   sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE);
   796   SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
   797   SDLTest_AssertCheck(
   798     sresult == SHRT_MIN,
   799     "Validate result value for parameters(SHRT_MIN,SHRT_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, SHRT_MIN, sresult);
   800   lastError = (char *)SDL_GetError();
   801   SDLTest_AssertPass("SDL_GetError()");
   802   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   803              "SDL_GetError(): expected message '%s', was message: '%s'",
   804              expectedError,
   805              lastError);
   806 
   807   /* Clear error messages */
   808   SDL_ClearError();
   809   SDLTest_AssertPass("SDL_ClearError()");
   810 
   811   return TEST_COMPLETED;
   812 }
   813 
   814 /*
   815  * @brief Calls to random boundary number generators for Sint32
   816  */
   817 int
   818 sdltest_randomBoundaryNumberSint32(void *arg)
   819 {
   820   const char *expectedError = "That operation is not supported";
   821   char *lastError;
   822   Sint64 sresult;
   823 #if ((ULONG_MAX) == (UINT_MAX))
   824   Sint32 long_min = LONG_MIN;
   825   Sint32 long_max = LONG_MAX;
   826 #else
   827   Sint32 long_min = INT_MIN;
   828   Sint32 long_max = INT_MAX;
   829 #endif
   830 
   831   /* Clean error messages */
   832   SDL_ClearError();
   833   SDLTest_AssertPass("SDL_ClearError()");
   834 
   835   /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   836   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 10, SDL_TRUE);
   837   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   838   SDLTest_AssertCheck(
   839     sresult == 10,
   840     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, sresult);
   841 
   842   /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   843   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 11, SDL_TRUE);
   844   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   845   SDLTest_AssertCheck(
   846     sresult == 10 || sresult == 11,
   847     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, sresult);
   848 
   849   /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   850   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 12, SDL_TRUE);
   851   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   852   SDLTest_AssertCheck(
   853     sresult == 10 || sresult == 11 || sresult == 12,
   854     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, sresult);
   855 
   856   /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   857   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 13, SDL_TRUE);
   858   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   859   SDLTest_AssertCheck(
   860     sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   861     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, sresult);
   862 
   863   /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   864   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(10, 20, SDL_TRUE);
   865   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   866   SDLTest_AssertCheck(
   867     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   868     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   869 
   870   /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   871   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(20, 10, SDL_TRUE);
   872   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   873   SDLTest_AssertCheck(
   874     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   875     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   876 
   877   /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   878   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(1, 20, SDL_FALSE);
   879   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   880   SDLTest_AssertCheck(
   881     sresult == 0 || sresult == 21,
   882     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult);
   883 
   884   /* RandomSintXBoundaryValue(LONG_MIN, 99, SDL_FALSE) returns 100 */
   885   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, 99, SDL_FALSE);
   886   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   887   SDLTest_AssertCheck(
   888     sresult == 100,
   889     "Validate result value for parameters (LONG_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult);
   890 
   891   /* RandomSintXBoundaryValue(LONG_MIN + 1, LONG_MAX, SDL_FALSE) returns LONG_MIN (no error) */
   892   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min + 1, long_max, SDL_FALSE);
   893   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   894   SDLTest_AssertCheck(
   895     sresult == long_min,
   896     "Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult);
   897   lastError = (char *)SDL_GetError();
   898   SDLTest_AssertPass("SDL_GetError()");
   899   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   900 
   901   /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE) returns LONG_MAX (no error) */
   902   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE);
   903   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   904   SDLTest_AssertCheck(
   905     sresult == long_max,
   906     "Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_max, sresult);
   907   lastError = (char *)SDL_GetError();
   908   SDLTest_AssertPass("SDL_GetError()");
   909   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
   910 
   911   /* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE) returns 0 (sets error) */
   912   sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE);
   913   SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
   914   SDLTest_AssertCheck(
   915     sresult == long_min,
   916     "Validate result value for parameters(LONG_MIN,LONG_MAX,SDL_FALSE); expected: %d, got: %"SDL_PRIs64, long_min, sresult);
   917   lastError = (char *)SDL_GetError();
   918   SDLTest_AssertPass("SDL_GetError()");
   919   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
   920              "SDL_GetError(): expected message '%s', was message: '%s'",
   921              expectedError,
   922              lastError);
   923 
   924   /* Clear error messages */
   925   SDL_ClearError();
   926   SDLTest_AssertPass("SDL_ClearError()");
   927 
   928   return TEST_COMPLETED;
   929 }
   930 
   931 /*
   932  * @brief Calls to random boundary number generators for Sint64
   933  */
   934 int
   935 sdltest_randomBoundaryNumberSint64(void *arg)
   936 {
   937   const char *expectedError = "That operation is not supported";
   938   char *lastError;
   939   Sint64 sresult;
   940 
   941   /* Clean error messages */
   942   SDL_ClearError();
   943   SDLTest_AssertPass("SDL_ClearError()");
   944 
   945   /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
   946   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 10, SDL_TRUE);
   947   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   948   SDLTest_AssertCheck(
   949     sresult == 10,
   950     "Validate result value for parameters (10,10,SDL_TRUE); expected: 10, got: %"SDL_PRIs64, sresult);
   951 
   952   /* RandomSintXBoundaryValue(10, 11, SDL_TRUE) returns 10, 11 */
   953   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 11, SDL_TRUE);
   954   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   955   SDLTest_AssertCheck(
   956     sresult == 10 || sresult == 11,
   957     "Validate result value for parameters (10,11,SDL_TRUE); expected: 10|11, got: %"SDL_PRIs64, sresult);
   958 
   959   /* RandomSintXBoundaryValue(10, 12, SDL_TRUE) returns 10, 11, 12 */
   960   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 12, SDL_TRUE);
   961   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   962   SDLTest_AssertCheck(
   963     sresult == 10 || sresult == 11 || sresult == 12,
   964     "Validate result value for parameters (10,12,SDL_TRUE); expected: 10|11|12, got: %"SDL_PRIs64, sresult);
   965 
   966   /* RandomSintXBoundaryValue(10, 13, SDL_TRUE) returns 10, 11, 12, 13 */
   967   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 13, SDL_TRUE);
   968   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   969   SDLTest_AssertCheck(
   970     sresult == 10 || sresult == 11 || sresult == 12 || sresult == 13,
   971     "Validate result value for parameters (10,13,SDL_TRUE); expected: 10|11|12|13, got: %"SDL_PRIs64, sresult);
   972 
   973   /* RandomSintXBoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 */
   974   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(10, 20, SDL_TRUE);
   975   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   976   SDLTest_AssertCheck(
   977     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   978     "Validate result value for parameters (10,20,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   979 
   980   /* RandomSintXBoundaryValue(20, 10, SDL_TRUE) returns 10, 11, 19 or 20 */
   981   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(20, 10, SDL_TRUE);
   982   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   983   SDLTest_AssertCheck(
   984     sresult == 10 || sresult == 11 || sresult == 19 || sresult == 20,
   985     "Validate result value for parameters (20,10,SDL_TRUE); expected: 10|11|19|20, got: %"SDL_PRIs64, sresult);
   986 
   987   /* RandomSintXBoundaryValue(1, 20, SDL_FALSE) returns 0, 21 */
   988   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(1, 20, SDL_FALSE);
   989   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   990   SDLTest_AssertCheck(
   991     sresult == 0 || sresult == 21,
   992     "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult);
   993 
   994   /* RandomSintXBoundaryValue(LLONG_MIN, 99, SDL_FALSE) returns 100 */
   995   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, 99, SDL_FALSE);
   996   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
   997   SDLTest_AssertCheck(
   998     sresult == 100,
   999     "Validate result value for parameters (LLONG_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult);
  1000 
  1001   /* RandomSintXBoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE) returns LLONG_MIN (no error) */
  1002   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN + 1, INT64_MAX, SDL_FALSE);
  1003   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
  1004   SDLTest_AssertCheck(
  1005     sresult == INT64_MIN,
  1006     "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult);
  1007   lastError = (char *)SDL_GetError();
  1008   SDLTest_AssertPass("SDL_GetError()");
  1009   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  1010 
  1011   /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */
  1012   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX - 1, SDL_FALSE);
  1013   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
  1014   SDLTest_AssertCheck(
  1015     sresult == INT64_MAX,
  1016     "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MAX, sresult);
  1017   lastError = (char *)SDL_GetError();
  1018   SDLTest_AssertPass("SDL_GetError()");
  1019   SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
  1020 
  1021   /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */
  1022   sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX, SDL_FALSE);
  1023   SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
  1024   SDLTest_AssertCheck(
  1025     sresult == INT64_MIN,
  1026     "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult);
  1027   lastError = (char *)SDL_GetError();
  1028   SDLTest_AssertPass("SDL_GetError()");
  1029   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
  1030              "SDL_GetError(): expected message '%s', was message: '%s'",
  1031              expectedError,
  1032              lastError);
  1033 
  1034   /* Clear error messages */
  1035   SDL_ClearError();
  1036   SDLTest_AssertPass("SDL_ClearError()");
  1037 
  1038   return TEST_COMPLETED;
  1039 }
  1040 
  1041 /**
  1042  * @brief Calls to SDLTest_RandomIntegerInRange
  1043  */
  1044 int
  1045 sdltest_randomIntegerInRange(void *arg)
  1046 {
  1047   Sint32 min, max;
  1048   Sint32 result;
  1049 #if ((ULONG_MAX) == (UINT_MAX))
  1050   Sint32 long_min = LONG_MIN;
  1051   Sint32 long_max = LONG_MAX;
  1052 #else
  1053   Sint32 long_min = INT_MIN;
  1054   Sint32 long_max = INT_MAX;
  1055 #endif
  1056 
  1057   /* Standard range */
  1058   min = (Sint32)SDLTest_RandomSint16();
  1059   max = min + (Sint32)SDLTest_RandomUint8() + 2;
  1060   result = SDLTest_RandomIntegerInRange(min, max);
  1061   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,max)");
  1062   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1063 
  1064   /* One Range */
  1065   min = (Sint32)SDLTest_RandomSint16();
  1066   max = min + 1;
  1067   result = SDLTest_RandomIntegerInRange(min, max);
  1068   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min+1)");
  1069   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1070 
  1071   /* Zero range */
  1072   min = (Sint32)SDLTest_RandomSint16();
  1073   max = min;
  1074   result = SDLTest_RandomIntegerInRange(min, max);
  1075   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(min,min)");
  1076   SDLTest_AssertCheck(min == result, "Validated returned value; expected: %d, got: %d", min, result);
  1077 
  1078   /* Zero range at zero */
  1079   min = 0;
  1080   max = 0;
  1081   result = SDLTest_RandomIntegerInRange(min, max);
  1082   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(0,0)");
  1083   SDLTest_AssertCheck(result == 0, "Validated returned value; expected: 0, got: %d", result);
  1084 
  1085   /* Swapped min-max */
  1086   min = (Sint32)SDLTest_RandomSint16();
  1087   max = min + (Sint32)SDLTest_RandomUint8() + 2;
  1088   result = SDLTest_RandomIntegerInRange(max, min);
  1089   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(max,min)");
  1090   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1091 
  1092   /* Range with min at integer limit */
  1093   min = long_min;
  1094   max = long_max + (Sint32)SDLTest_RandomSint16();
  1095   result = SDLTest_RandomIntegerInRange(min, max);
  1096   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)");
  1097   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1098 
  1099   /* Range with max at integer limit */
  1100   min = long_min - (Sint32)SDLTest_RandomSint16();
  1101   max = long_max;
  1102   result = SDLTest_RandomIntegerInRange(min, max);
  1103   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");
  1104   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1105 
  1106   /* Full integer range */
  1107   min = long_min;
  1108   max = long_max;
  1109   result = SDLTest_RandomIntegerInRange(min, max);
  1110   SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,SINT32_MAX)");
  1111   SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result);
  1112 
  1113   return TEST_COMPLETED;
  1114 }
  1115 
  1116 /**
  1117  * @brief Calls to SDLTest_RandomAsciiString
  1118  */
  1119 int
  1120 sdltest_randomAsciiString(void *arg)
  1121 {
  1122   char* result;
  1123   size_t len;
  1124   int nonAsciiCharacters;
  1125   size_t i;
  1126 
  1127   result = SDLTest_RandomAsciiString();
  1128   SDLTest_AssertPass("Call to SDLTest_RandomAsciiString()");
  1129   SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
  1130   if (result != NULL) {
  1131      len = SDL_strlen(result);
  1132      SDLTest_AssertCheck(len >= 1 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", (int) len);
  1133      nonAsciiCharacters = 0;
  1134      for (i=0; i<len; i++) {
  1135        if (iscntrl(result[i])) {
  1136          nonAsciiCharacters++;
  1137        }
  1138      }
  1139      SDLTest_AssertCheck(nonAsciiCharacters == 0, "Validate that result does not contain non-Ascii characters, got: %d", nonAsciiCharacters);
  1140      if (nonAsciiCharacters) {
  1141         SDLTest_LogError("Invalid result from generator: '%s'", result);
  1142      }
  1143      SDL_free(result);
  1144   }
  1145 
  1146   return TEST_COMPLETED;
  1147 }
  1148 
  1149 
  1150 /**
  1151  * @brief Calls to SDLTest_RandomAsciiStringWithMaximumLength
  1152  */
  1153 int
  1154 sdltest_randomAsciiStringWithMaximumLength(void *arg)
  1155 {
  1156   const char* expectedError = "Parameter 'maxLength' is invalid";
  1157   char* lastError;
  1158   char* result;
  1159   size_t targetLen;
  1160   size_t len;
  1161   int nonAsciiCharacters;
  1162   size_t i;
  1163 
  1164   targetLen = 16 + SDLTest_RandomUint8();
  1165   result = SDLTest_RandomAsciiStringWithMaximumLength((int) targetLen);
  1166   SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", targetLen);
  1167   SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
  1168   if (result != NULL) {
  1169      len = SDL_strlen(result);
  1170      SDLTest_AssertCheck(len >= 1 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", (int) targetLen, (int) len);
  1171      nonAsciiCharacters = 0;
  1172      for (i=0; i<len; i++) {
  1173        if (iscntrl(result[i])) {
  1174          nonAsciiCharacters++;
  1175        }
  1176      }
  1177      SDLTest_AssertCheck(nonAsciiCharacters == 0, "Validate that result does not contain non-Ascii characters, got: %d", nonAsciiCharacters);
  1178      if (nonAsciiCharacters) {
  1179         SDLTest_LogError("Invalid result from generator: '%s'", result);
  1180      }
  1181      SDL_free(result);
  1182   }
  1183 
  1184   /* Negative test */
  1185   targetLen = 0;
  1186   result = SDLTest_RandomAsciiStringWithMaximumLength((int) targetLen);
  1187   SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", targetLen);
  1188   SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1189   lastError = (char *)SDL_GetError();
  1190   SDLTest_AssertPass("SDL_GetError()");
  1191   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
  1192              "SDL_GetError(): expected message '%s', was message: '%s'",
  1193              expectedError,
  1194              lastError);
  1195 
  1196   /* Clear error messages */
  1197   SDL_ClearError();
  1198   SDLTest_AssertPass("SDL_ClearError()");
  1199 
  1200   return TEST_COMPLETED;
  1201 }
  1202 
  1203 /**
  1204  * @brief Calls to SDLTest_RandomAsciiStringOfSize
  1205  */
  1206 int
  1207 sdltest_randomAsciiStringOfSize(void *arg)
  1208 {
  1209   const char* expectedError = "Parameter 'size' is invalid";
  1210   char* lastError;
  1211   char* result;
  1212   size_t targetLen;
  1213   size_t len;
  1214   int nonAsciiCharacters;
  1215   size_t i;
  1216 
  1217   /* Positive test */
  1218   targetLen = 16 + SDLTest_RandomUint8();
  1219   result = SDLTest_RandomAsciiStringOfSize((int) targetLen);
  1220   SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", targetLen);
  1221   SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
  1222   if (result != NULL) {
  1223      len = SDL_strlen(result);
  1224      SDLTest_AssertCheck(len == targetLen, "Validate that result length; expected: len=%d, got: %d", (int) targetLen, (int) len);
  1225      nonAsciiCharacters = 0;
  1226      for (i=0; i<len; i++) {
  1227        if (iscntrl(result[i])) {
  1228          nonAsciiCharacters++;
  1229        }
  1230      }
  1231      SDLTest_AssertCheck(nonAsciiCharacters == 0, "Validate that result does not contain non-ASCII characters, got: %d", nonAsciiCharacters);
  1232      if (nonAsciiCharacters) {
  1233         SDLTest_LogError("Invalid result from generator: '%s'", result);
  1234      }
  1235      SDL_free(result);
  1236   }
  1237 
  1238   /* Negative test */
  1239   targetLen = 0;
  1240   result = SDLTest_RandomAsciiStringOfSize((int) targetLen);
  1241   SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringOfSize(%d)", targetLen);
  1242   SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1243   lastError = (char *)SDL_GetError();
  1244   SDLTest_AssertPass("SDL_GetError()");
  1245   SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0,
  1246              "SDL_GetError(): expected message '%s', was message: '%s'",
  1247              expectedError,
  1248              lastError);
  1249 
  1250   /* Clear error messages */
  1251   SDL_ClearError();
  1252   SDLTest_AssertPass("SDL_ClearError()");
  1253 
  1254   return TEST_COMPLETED;
  1255 }
  1256 
  1257 
  1258 /* ================= Test References ================== */
  1259 
  1260 /* SDL_test test cases */
  1261 static const SDLTest_TestCaseReference sdltestTest1 =
  1262         { (SDLTest_TestCaseFp)sdltest_getFuzzerInvocationCount, "sdltest_getFuzzerInvocationCount", "Call to sdltest_GetFuzzerInvocationCount", TEST_ENABLED };
  1263 
  1264 static const SDLTest_TestCaseReference sdltestTest2 =
  1265         { (SDLTest_TestCaseFp)sdltest_randomNumber, "sdltest_randomNumber", "Calls to random number generators", TEST_ENABLED };
  1266 
  1267 static const SDLTest_TestCaseReference sdltestTest3 =
  1268         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint8, "sdltest_randomBoundaryNumberUint8", "Calls to random boundary number generators for Uint8", TEST_ENABLED };
  1269 
  1270 static const SDLTest_TestCaseReference sdltestTest4 =
  1271         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint16, "sdltest_randomBoundaryNumberUint16", "Calls to random boundary number generators for Uint16", TEST_ENABLED };
  1272 
  1273 static const SDLTest_TestCaseReference sdltestTest5 =
  1274         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint32, "sdltest_randomBoundaryNumberUint32", "Calls to random boundary number generators for Uint32", TEST_ENABLED };
  1275 
  1276 static const SDLTest_TestCaseReference sdltestTest6 =
  1277         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint64, "sdltest_randomBoundaryNumberUint64", "Calls to random boundary number generators for Uint64", TEST_ENABLED };
  1278 
  1279 static const SDLTest_TestCaseReference sdltestTest7 =
  1280         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint8, "sdltest_randomBoundaryNumberSint8", "Calls to random boundary number generators for Sint8", TEST_ENABLED };
  1281 
  1282 static const SDLTest_TestCaseReference sdltestTest8 =
  1283         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint16, "sdltest_randomBoundaryNumberSint16", "Calls to random boundary number generators for Sint16", TEST_ENABLED };
  1284 
  1285 static const SDLTest_TestCaseReference sdltestTest9 =
  1286         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint32, "sdltest_randomBoundaryNumberSint32", "Calls to random boundary number generators for Sint32", TEST_ENABLED };
  1287 
  1288 static const SDLTest_TestCaseReference sdltestTest10 =
  1289         { (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint64, "sdltest_randomBoundaryNumberSint64", "Calls to random boundary number generators for Sint64", TEST_ENABLED };
  1290 
  1291 static const SDLTest_TestCaseReference sdltestTest11 =
  1292         { (SDLTest_TestCaseFp)sdltest_randomIntegerInRange, "sdltest_randomIntegerInRange", "Calls to ranged random number generator", TEST_ENABLED };
  1293 
  1294 static const SDLTest_TestCaseReference sdltestTest12 =
  1295         { (SDLTest_TestCaseFp)sdltest_randomAsciiString, "sdltest_randomAsciiString", "Calls to default ASCII string generator", TEST_ENABLED };
  1296 
  1297 static const SDLTest_TestCaseReference sdltestTest13 =
  1298         { (SDLTest_TestCaseFp)sdltest_randomAsciiStringWithMaximumLength, "sdltest_randomAsciiStringWithMaximumLength", "Calls to random maximum length ASCII string generator", TEST_ENABLED };
  1299 
  1300 static const SDLTest_TestCaseReference sdltestTest14 =
  1301         { (SDLTest_TestCaseFp)sdltest_randomAsciiStringOfSize, "sdltest_randomAsciiStringOfSize", "Calls to fixed size ASCII string generator", TEST_ENABLED };
  1302 
  1303 static const SDLTest_TestCaseReference sdltestTest15 =
  1304         { (SDLTest_TestCaseFp)sdltest_generateRunSeed, "sdltest_generateRunSeed", "Checks internal harness function SDLTest_GenerateRunSeed", TEST_ENABLED };
  1305 
  1306 /* Sequence of SDL_test test cases */
  1307 static const SDLTest_TestCaseReference *sdltestTests[] =  {
  1308     &sdltestTest1, &sdltestTest2, &sdltestTest3, &sdltestTest4, &sdltestTest5, &sdltestTest6,
  1309     &sdltestTest7, &sdltestTest8, &sdltestTest9, &sdltestTest10, &sdltestTest11, &sdltestTest12,
  1310     &sdltestTest13, &sdltestTest14, &sdltestTest15, NULL
  1311 };
  1312 
  1313 /* SDL_test test suite (global) */
  1314 SDLTest_TestSuiteReference sdltestTestSuite = {
  1315     "SDLtest",
  1316     NULL,
  1317     sdltestTests,
  1318     NULL
  1319 };