SDL 2.0
testautomation_sdltest.c File Reference
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <float.h>
#include <ctype.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for testautomation_sdltest.c:

Go to the source code of this file.

Functions

char * SDLTest_GenerateRunSeed (const int length)
 Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). More...
 
int sdltest_generateRunSeed (void *arg)
 Calls to SDLTest_GenerateRunSeed() More...
 
int sdltest_getFuzzerInvocationCount (void *arg)
 Calls to SDLTest_GetFuzzerInvocationCount() More...
 
int sdltest_randomNumber (void *arg)
 Calls to random number generators. More...
 
int sdltest_randomBoundaryNumberUint8 (void *arg)
 
int sdltest_randomBoundaryNumberUint16 (void *arg)
 
int sdltest_randomBoundaryNumberUint32 (void *arg)
 
int sdltest_randomBoundaryNumberUint64 (void *arg)
 
int sdltest_randomBoundaryNumberSint8 (void *arg)
 
int sdltest_randomBoundaryNumberSint16 (void *arg)
 
int sdltest_randomBoundaryNumberSint32 (void *arg)
 
int sdltest_randomBoundaryNumberSint64 (void *arg)
 
int sdltest_randomIntegerInRange (void *arg)
 Calls to SDLTest_RandomIntegerInRange. More...
 
int sdltest_randomAsciiString (void *arg)
 Calls to SDLTest_RandomAsciiString. More...
 
int sdltest_randomAsciiStringWithMaximumLength (void *arg)
 Calls to SDLTest_RandomAsciiStringWithMaximumLength. More...
 
int sdltest_randomAsciiStringOfSize (void *arg)
 Calls to SDLTest_RandomAsciiStringOfSize. More...
 

Variables

static const SDLTest_TestCaseReference sdltestTest1
 
static const SDLTest_TestCaseReference sdltestTest2
 
static const SDLTest_TestCaseReference sdltestTest3
 
static const SDLTest_TestCaseReference sdltestTest4
 
static const SDLTest_TestCaseReference sdltestTest5
 
static const SDLTest_TestCaseReference sdltestTest6
 
static const SDLTest_TestCaseReference sdltestTest7
 
static const SDLTest_TestCaseReference sdltestTest8
 
static const SDLTest_TestCaseReference sdltestTest9
 
static const SDLTest_TestCaseReference sdltestTest10
 
static const SDLTest_TestCaseReference sdltestTest11
 
static const SDLTest_TestCaseReference sdltestTest12
 
static const SDLTest_TestCaseReference sdltestTest13
 
static const SDLTest_TestCaseReference sdltestTest14
 
static const SDLTest_TestCaseReference sdltestTest15
 
static const SDLTest_TestCaseReferencesdltestTests []
 
SDLTest_TestSuiteReference sdltestTestSuite
 

Function Documentation

◆ SDLTest_GenerateRunSeed()

char * SDLTest_GenerateRunSeed ( const int  length)

Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).

SDL_test test suite

Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).

Note: The returned string needs to be deallocated by the caller.

Parameters
lengthThe length of the seed string to generate
Returns
The generated seed string

Definition at line 54 of file SDL_test_harness.c.

55{
56 char *seed = NULL;
57 SDLTest_RandomContext randomContext;
58 int counter;
59
60 /* Sanity check input */
61 if (length <= 0) {
62 SDLTest_LogError("The length of the harness seed must be >0.");
63 return NULL;
64 }
65
66 /* Allocate output buffer */
67 seed = (char *)SDL_malloc((length + 1) * sizeof(char));
68 if (seed == NULL) {
69 SDLTest_LogError("SDL_malloc for run seed output buffer failed.");
71 return NULL;
72 }
73
74 /* Generate a random string of alphanumeric characters */
75 SDLTest_RandomInitTime(&randomContext);
76 for (counter = 0; counter < length; counter++) {
77 unsigned int number = SDLTest_Random(&randomContext);
78 char ch = (char) (number % (91 - 48)) + 48;
79 if (ch >= 58 && ch <= 64) {
80 ch = 65;
81 }
82 seed[counter] = ch;
83 }
84 seed[length] = '\0';
85
86 return seed;
87}
#define SDL_Error
#define SDL_malloc
@ SDL_ENOMEM
Definition: SDL_error.h:57
GLuint GLsizei GLsizei * length
GLuint counter
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
Definition: SDL_test_log.c:103
void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext)
Initialize random number generator based on current system time.
unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext)
Initialize random number generator based on current system time.
#define NULL
Definition: begin_code.h:167

Referenced by sdltest_generateRunSeed(), and SDLTest_RunSuites().

◆ sdltest_generateRunSeed()

int sdltest_generateRunSeed ( void arg)

Calls to SDLTest_GenerateRunSeed()

Definition at line 34 of file testautomation_sdltest.c.

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);
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}
#define SDL_strlen
#define SDL_free
GLuint64EXT * result
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
#define TEST_COMPLETED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:50
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
char * SDLTest_GenerateRunSeed(const int length)
Generates a random run seed string for the harness. The generated seed will contain alphanumeric char...

References i, j, NULL, SDL_free, SDL_strlen, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_GenerateRunSeed(), and TEST_COMPLETED.

◆ sdltest_getFuzzerInvocationCount()

int sdltest_getFuzzerInvocationCount ( void arg)

Calls to SDLTest_GetFuzzerInvocationCount()

Definition at line 65 of file testautomation_sdltest.c.

66{
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
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}
uint8_t Uint8
Definition: SDL_stdinc.h:179
int SDLTest_GetFuzzerInvocationCount(void)
Uint8 SDLTest_RandomUint8(void)

References SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_GetFuzzerInvocationCount(), SDLTest_RandomUint8(), and TEST_COMPLETED.

◆ sdltest_randomAsciiString()

int sdltest_randomAsciiString ( void arg)

Calls to SDLTest_RandomAsciiString.

Definition at line 1120 of file testautomation_sdltest.c.

1121{
1122 char* result;
1123 size_t len;
1124 int nonAsciiCharacters;
1125 size_t i;
1126
1128 SDLTest_AssertPass("Call to SDLTest_RandomAsciiString()");
1129 SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
1130 if (result != NULL) {
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 }
1144 }
1145
1146 return TEST_COMPLETED;
1147}
GLenum GLsizei len
char * SDLTest_RandomAsciiString(void)

References i, NULL, SDL_free, SDL_strlen, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_LogError(), SDLTest_RandomAsciiString(), and TEST_COMPLETED.

◆ sdltest_randomAsciiStringOfSize()

int sdltest_randomAsciiStringOfSize ( void arg)

Calls to SDLTest_RandomAsciiStringOfSize.

Definition at line 1207 of file testautomation_sdltest.c.

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) {
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 }
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 */
1252 SDLTest_AssertPass("SDL_ClearError()");
1253
1254 return TEST_COMPLETED;
1255}
#define SDL_GetError
#define SDL_ClearError
#define SDL_strcmp
char * SDLTest_RandomAsciiStringOfSize(int size)

References i, NULL, SDL_ClearError, SDL_free, SDL_GetError, SDL_strcmp, SDL_strlen, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_LogError(), SDLTest_RandomAsciiStringOfSize(), SDLTest_RandomUint8(), and TEST_COMPLETED.

◆ sdltest_randomAsciiStringWithMaximumLength()

int sdltest_randomAsciiStringWithMaximumLength ( void arg)

Calls to SDLTest_RandomAsciiStringWithMaximumLength.

Definition at line 1154 of file testautomation_sdltest.c.

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();
1166 SDLTest_AssertPass("Call to SDLTest_RandomAsciiStringWithMaximumLength(%d)", targetLen);
1167 SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL");
1168 if (result != NULL) {
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 }
1182 }
1183
1184 /* Negative test */
1185 targetLen = 0;
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 */
1198 SDLTest_AssertPass("SDL_ClearError()");
1199
1200 return TEST_COMPLETED;
1201}
char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)

References i, NULL, SDL_ClearError, SDL_free, SDL_GetError, SDL_strcmp, SDL_strlen, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_LogError(), SDLTest_RandomAsciiStringWithMaximumLength(), SDLTest_RandomUint8(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberSint16()

int sdltest_randomBoundaryNumberSint16 ( void arg)

Definition at line 708 of file testautomation_sdltest.c.

709{
710 const char *expectedError = "That operation is not supported";
711 char *lastError;
712 Sint64 sresult;
713
714 /* Clean error messages */
716 SDLTest_AssertPass("SDL_ClearError()");
717
718 /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
720 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
727 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
734 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
741 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
748 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
755 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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 */
762 SDLTest_AssertPass("Call to SDLTest_RandomSint16BoundaryValue");
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");
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");
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");
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");
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 */
809 SDLTest_AssertPass("SDL_ClearError()");
810
811 return TEST_COMPLETED;
812}
@ SDL_TRUE
Definition: SDL_stdinc.h:164
@ SDL_FALSE
Definition: SDL_stdinc.h:163
#define SDL_PRIs64
Definition: SDL_stdinc.h:227
int64_t Sint64
Definition: SDL_stdinc.h:210
Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomSint16BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberSint32()

int sdltest_randomBoundaryNumberSint32 ( void arg)

Definition at line 818 of file testautomation_sdltest.c.

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 */
833 SDLTest_AssertPass("SDL_ClearError()");
834
835 /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
837 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
844 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
851 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
858 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
865 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
872 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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 */
879 SDLTest_AssertPass("Call to SDLTest_RandomSint32BoundaryValue");
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");
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");
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");
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");
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 */
926 SDLTest_AssertPass("SDL_ClearError()");
927
928 return TEST_COMPLETED;
929}
int32_t Sint32
Definition: SDL_stdinc.h:197
Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
#define INT_MAX
Definition: SDL_wave.c:31

References INT_MAX, NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomSint32BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberSint64()

int sdltest_randomBoundaryNumberSint64 ( void arg)

Definition at line 935 of file testautomation_sdltest.c.

936{
937 const char *expectedError = "That operation is not supported";
938 char *lastError;
939 Sint64 sresult;
940
941 /* Clean error messages */
943 SDLTest_AssertPass("SDL_ClearError()");
944
945 /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
947 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
954 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
961 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
968 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
975 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
982 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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 */
989 SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue");
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");
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");
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");
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");
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 */
1036 SDLTest_AssertPass("SDL_ClearError()");
1037
1038 return TEST_COMPLETED;
1039}
Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomSint64BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberSint8()

int sdltest_randomBoundaryNumberSint8 ( void arg)

Definition at line 598 of file testautomation_sdltest.c.

599{
600 const char *expectedError = "That operation is not supported";
601 char *lastError;
602 Sint64 sresult;
603
604 /* Clean error messages */
606 SDLTest_AssertPass("SDL_ClearError()");
607
608 /* RandomSintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
610 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
617 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
624 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
631 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
638 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
645 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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 */
652 SDLTest_AssertPass("Call to SDLTest_RandomSint8BoundaryValue");
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");
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");
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");
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");
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 */
699 SDLTest_AssertPass("SDL_ClearError()");
700
701 return TEST_COMPLETED;
702}
Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomSint8BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberUint16()

int sdltest_randomBoundaryNumberUint16 ( void arg)

Definition at line 268 of file testautomation_sdltest.c.

269{
270 const char *expectedError = "That operation is not supported";
271 char *lastError;
272 Uint64 uresult;
273
274 /* Clean error messages */
276 SDLTest_AssertPass("SDL_ClearError()");
277
278 /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
280 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
287 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
294 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
301 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
308 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
315 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
322 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
329 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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) */
336 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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) */
346 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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) */
356 SDLTest_AssertPass("Call to SDLTest_RandomUint16BoundaryValue");
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 */
369 SDLTest_AssertPass("SDL_ClearError()");
370
371 return TEST_COMPLETED;
372}
uint64_t Uint64
Definition: SDL_stdinc.h:216
Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomUint16BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberUint32()

int sdltest_randomBoundaryNumberUint32 ( void arg)

Definition at line 378 of file testautomation_sdltest.c.

379{
380 const char *expectedError = "That operation is not supported";
381 char *lastError;
382 Uint64 uresult;
383
384 /* Clean error messages */
386 SDLTest_AssertPass("SDL_ClearError()");
387
388 /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
390 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
397 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
404 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
411 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
418 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
425 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
432 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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 */
439 SDLTest_AssertPass("Call to SDLTest_RandomUint32BoundaryValue");
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");
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");
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");
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 */
479 SDLTest_AssertPass("SDL_ClearError()");
480
481 return TEST_COMPLETED;
482}
Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomUint32BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberUint64()

int sdltest_randomBoundaryNumberUint64 ( void arg)

Definition at line 488 of file testautomation_sdltest.c.

489{
490 const char *expectedError = "That operation is not supported";
491 char *lastError;
492 Uint64 uresult;
493
494 /* Clean error messages */
496 SDLTest_AssertPass("SDL_ClearError()");
497
498 /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
500 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
507 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
514 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
521 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
528 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
535 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
542 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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 */
549 SDLTest_AssertPass("Call to SDLTest_RandomUint64BoundaryValue");
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");
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");
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");
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 */
589 SDLTest_AssertPass("SDL_ClearError()");
590
591 return TEST_COMPLETED;
592}
Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomUint64BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomBoundaryNumberUint8()

int sdltest_randomBoundaryNumberUint8 ( void arg)

Definition at line 158 of file testautomation_sdltest.c.

159{
160 const char *expectedError = "That operation is not supported";
161 char *lastError;
162 Uint64 uresult;
163
164 /* Clean error messages */
166 SDLTest_AssertPass("SDL_ClearError()");
167
168 /* RandomUintXBoundaryValue(10, 10, SDL_TRUE) returns 10 */
170 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
177 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
184 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
191 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
198 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
205 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
212 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
219 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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) */
226 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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) */
236 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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) */
246 SDLTest_AssertPass("Call to SDLTest_RandomUint8BoundaryValue");
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 */
259 SDLTest_AssertPass("SDL_ClearError()");
260
261 return TEST_COMPLETED;
262}
Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)

References NULL, SDL_ClearError, SDL_FALSE, SDL_GetError, SDL_PRIs64, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomUint8BoundaryValue(), and TEST_COMPLETED.

◆ sdltest_randomIntegerInRange()

int sdltest_randomIntegerInRange ( void arg)

Calls to SDLTest_RandomIntegerInRange.

Definition at line 1045 of file testautomation_sdltest.c.

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 */
1059 max = min + (Sint32)SDLTest_RandomUint8() + 2;
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 */
1066 max = min + 1;
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 */
1073 max = min;
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;
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 */
1087 max = min + (Sint32)SDLTest_RandomUint8() + 2;
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();
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;
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;
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}
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
Sint16 SDLTest_RandomSint16(void)

References INT_MAX, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomIntegerInRange(), SDLTest_RandomSint16(), SDLTest_RandomUint8(), and TEST_COMPLETED.

◆ sdltest_randomNumber()

int sdltest_randomNumber ( void arg)

Calls to random number generators.

Definition at line 89 of file testautomation_sdltest.c.

90{
92 Uint64 uresult;
93 double dresult;
94 Uint64 umax;
95 Sint64 min, max;
96
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
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
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
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
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
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
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}
#define SDL_PRIu64
Definition: SDL_stdinc.h:238
Sint32 SDLTest_RandomSint32(void)
float SDLTest_RandomUnitFloat(void)
double SDLTest_RandomDouble(void)
Uint64 SDLTest_RandomUint64(void)
Uint16 SDLTest_RandomUint16(void)
float SDLTest_RandomFloat(void)
Uint32 SDLTest_RandomUint32(void)
double SDLTest_RandomUnitDouble(void)
Sint64 SDLTest_RandomSint64(void)
Sint8 SDLTest_RandomSint8(void)

References SDL_PRIs64, SDL_PRIu64, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomDouble(), SDLTest_RandomFloat(), SDLTest_RandomSint16(), SDLTest_RandomSint32(), SDLTest_RandomSint64(), SDLTest_RandomSint8(), SDLTest_RandomUint16(), SDLTest_RandomUint32(), SDLTest_RandomUint64(), SDLTest_RandomUint8(), SDLTest_RandomUnitDouble(), SDLTest_RandomUnitFloat(), and TEST_COMPLETED.

Variable Documentation

◆ sdltestTest1

const SDLTest_TestCaseReference sdltestTest1
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_getFuzzerInvocationCount, "sdltest_getFuzzerInvocationCount", "Call to sdltest_GetFuzzerInvocationCount", TEST_ENABLED }
#define TEST_ENABLED
int(* SDLTest_TestCaseFp)(void *arg)
int sdltest_getFuzzerInvocationCount(void *arg)
Calls to SDLTest_GetFuzzerInvocationCount()

Definition at line 1261 of file testautomation_sdltest.c.

◆ sdltestTest10

const SDLTest_TestCaseReference sdltestTest10
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint64, "sdltest_randomBoundaryNumberSint64", "Calls to random boundary number generators for Sint64", TEST_ENABLED }
int sdltest_randomBoundaryNumberSint64(void *arg)

Definition at line 1288 of file testautomation_sdltest.c.

◆ sdltestTest11

const SDLTest_TestCaseReference sdltestTest11
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomIntegerInRange, "sdltest_randomIntegerInRange", "Calls to ranged random number generator", TEST_ENABLED }
int sdltest_randomIntegerInRange(void *arg)
Calls to SDLTest_RandomIntegerInRange.

Definition at line 1291 of file testautomation_sdltest.c.

◆ sdltestTest12

const SDLTest_TestCaseReference sdltestTest12
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomAsciiString, "sdltest_randomAsciiString", "Calls to default ASCII string generator", TEST_ENABLED }
int sdltest_randomAsciiString(void *arg)
Calls to SDLTest_RandomAsciiString.

Definition at line 1294 of file testautomation_sdltest.c.

◆ sdltestTest13

const SDLTest_TestCaseReference sdltestTest13
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomAsciiStringWithMaximumLength, "sdltest_randomAsciiStringWithMaximumLength", "Calls to random maximum length ASCII string generator", TEST_ENABLED }
int sdltest_randomAsciiStringWithMaximumLength(void *arg)
Calls to SDLTest_RandomAsciiStringWithMaximumLength.

Definition at line 1297 of file testautomation_sdltest.c.

◆ sdltestTest14

const SDLTest_TestCaseReference sdltestTest14
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomAsciiStringOfSize, "sdltest_randomAsciiStringOfSize", "Calls to fixed size ASCII string generator", TEST_ENABLED }
int sdltest_randomAsciiStringOfSize(void *arg)
Calls to SDLTest_RandomAsciiStringOfSize.

Definition at line 1300 of file testautomation_sdltest.c.

◆ sdltestTest15

const SDLTest_TestCaseReference sdltestTest15
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_generateRunSeed, "sdltest_generateRunSeed", "Checks internal harness function SDLTest_GenerateRunSeed", TEST_ENABLED }
int sdltest_generateRunSeed(void *arg)
Calls to SDLTest_GenerateRunSeed()

Definition at line 1303 of file testautomation_sdltest.c.

◆ sdltestTest2

const SDLTest_TestCaseReference sdltestTest2
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomNumber, "sdltest_randomNumber", "Calls to random number generators", TEST_ENABLED }
int sdltest_randomNumber(void *arg)
Calls to random number generators.

Definition at line 1264 of file testautomation_sdltest.c.

◆ sdltestTest3

const SDLTest_TestCaseReference sdltestTest3
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint8, "sdltest_randomBoundaryNumberUint8", "Calls to random boundary number generators for Uint8", TEST_ENABLED }
int sdltest_randomBoundaryNumberUint8(void *arg)

Definition at line 1267 of file testautomation_sdltest.c.

◆ sdltestTest4

const SDLTest_TestCaseReference sdltestTest4
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint16, "sdltest_randomBoundaryNumberUint16", "Calls to random boundary number generators for Uint16", TEST_ENABLED }
int sdltest_randomBoundaryNumberUint16(void *arg)

Definition at line 1270 of file testautomation_sdltest.c.

◆ sdltestTest5

const SDLTest_TestCaseReference sdltestTest5
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint32, "sdltest_randomBoundaryNumberUint32", "Calls to random boundary number generators for Uint32", TEST_ENABLED }
int sdltest_randomBoundaryNumberUint32(void *arg)

Definition at line 1273 of file testautomation_sdltest.c.

◆ sdltestTest6

const SDLTest_TestCaseReference sdltestTest6
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberUint64, "sdltest_randomBoundaryNumberUint64", "Calls to random boundary number generators for Uint64", TEST_ENABLED }
int sdltest_randomBoundaryNumberUint64(void *arg)

Definition at line 1276 of file testautomation_sdltest.c.

◆ sdltestTest7

const SDLTest_TestCaseReference sdltestTest7
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint8, "sdltest_randomBoundaryNumberSint8", "Calls to random boundary number generators for Sint8", TEST_ENABLED }
int sdltest_randomBoundaryNumberSint8(void *arg)

Definition at line 1279 of file testautomation_sdltest.c.

◆ sdltestTest8

const SDLTest_TestCaseReference sdltestTest8
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint16, "sdltest_randomBoundaryNumberSint16", "Calls to random boundary number generators for Sint16", TEST_ENABLED }
int sdltest_randomBoundaryNumberSint16(void *arg)

Definition at line 1282 of file testautomation_sdltest.c.

◆ sdltestTest9

const SDLTest_TestCaseReference sdltestTest9
static
Initial value:
=
{ (SDLTest_TestCaseFp)sdltest_randomBoundaryNumberSint32, "sdltest_randomBoundaryNumberSint32", "Calls to random boundary number generators for Sint32", TEST_ENABLED }
int sdltest_randomBoundaryNumberSint32(void *arg)

Definition at line 1285 of file testautomation_sdltest.c.

◆ sdltestTests

const SDLTest_TestCaseReference* sdltestTests[]
static
Initial value:
= {
}
static const SDLTest_TestCaseReference sdltestTest6
static const SDLTest_TestCaseReference sdltestTest8
static const SDLTest_TestCaseReference sdltestTest1
static const SDLTest_TestCaseReference sdltestTest9
static const SDLTest_TestCaseReference sdltestTest3
static const SDLTest_TestCaseReference sdltestTest15
static const SDLTest_TestCaseReference sdltestTest7
static const SDLTest_TestCaseReference sdltestTest12
static const SDLTest_TestCaseReference sdltestTest14
static const SDLTest_TestCaseReference sdltestTest5
static const SDLTest_TestCaseReference sdltestTest4
static const SDLTest_TestCaseReference sdltestTest2
static const SDLTest_TestCaseReference sdltestTest11
static const SDLTest_TestCaseReference sdltestTest13
static const SDLTest_TestCaseReference sdltestTest10

Definition at line 1307 of file testautomation_sdltest.c.

◆ sdltestTestSuite

SDLTest_TestSuiteReference sdltestTestSuite
Initial value:
= {
"SDLtest",
}
static const SDLTest_TestCaseReference * sdltestTests[]

Definition at line 1314 of file testautomation_sdltest.c.