SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:7fb6877b5d7c 1 /*
miruga27 0:7fb6877b5d7c 2 Simple DirectMedia Layer
miruga27 0:7fb6877b5d7c 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:7fb6877b5d7c 4
miruga27 0:7fb6877b5d7c 5 This software is provided 'as-is', without any express or implied
miruga27 0:7fb6877b5d7c 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:7fb6877b5d7c 7 arising from the use of this software.
miruga27 0:7fb6877b5d7c 8
miruga27 0:7fb6877b5d7c 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:7fb6877b5d7c 10 including commercial applications, and to alter it and redistribute it
miruga27 0:7fb6877b5d7c 11 freely, subject to the following restrictions:
miruga27 0:7fb6877b5d7c 12
miruga27 0:7fb6877b5d7c 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:7fb6877b5d7c 14 claim that you wrote the original software. If you use this software
miruga27 0:7fb6877b5d7c 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:7fb6877b5d7c 16 appreciated but is not required.
miruga27 0:7fb6877b5d7c 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:7fb6877b5d7c 18 misrepresented as being the original software.
miruga27 0:7fb6877b5d7c 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:7fb6877b5d7c 20 */
miruga27 0:7fb6877b5d7c 21
miruga27 0:7fb6877b5d7c 22 /**
miruga27 0:7fb6877b5d7c 23 * \file SDL_test_fuzzer.h
miruga27 0:7fb6877b5d7c 24 *
miruga27 0:7fb6877b5d7c 25 * Include file for SDL test framework.
miruga27 0:7fb6877b5d7c 26 *
miruga27 0:7fb6877b5d7c 27 * This code is a part of the SDL2_test library, not the main SDL library.
miruga27 0:7fb6877b5d7c 28 */
miruga27 0:7fb6877b5d7c 29
miruga27 0:7fb6877b5d7c 30 /*
miruga27 0:7fb6877b5d7c 31
miruga27 0:7fb6877b5d7c 32 Data generators for fuzzing test data in a reproducible way.
miruga27 0:7fb6877b5d7c 33
miruga27 0:7fb6877b5d7c 34 */
miruga27 0:7fb6877b5d7c 35
miruga27 0:7fb6877b5d7c 36 #ifndef _SDL_test_fuzzer_h
miruga27 0:7fb6877b5d7c 37 #define _SDL_test_fuzzer_h
miruga27 0:7fb6877b5d7c 38
miruga27 0:7fb6877b5d7c 39 #include "begin_code.h"
miruga27 0:7fb6877b5d7c 40 /* Set up for C function definitions, even when using C++ */
miruga27 0:7fb6877b5d7c 41 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 42 extern "C" {
miruga27 0:7fb6877b5d7c 43 #endif
miruga27 0:7fb6877b5d7c 44
miruga27 0:7fb6877b5d7c 45
miruga27 0:7fb6877b5d7c 46 /*
miruga27 0:7fb6877b5d7c 47 Based on GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
miruga27 0:7fb6877b5d7c 48 */
miruga27 0:7fb6877b5d7c 49
miruga27 0:7fb6877b5d7c 50
miruga27 0:7fb6877b5d7c 51 /**
miruga27 0:7fb6877b5d7c 52 * \file
miruga27 0:7fb6877b5d7c 53 * Note: The fuzzer implementation uses a static instance of random context
miruga27 0:7fb6877b5d7c 54 * internally which makes it thread-UNsafe.
miruga27 0:7fb6877b5d7c 55 */
miruga27 0:7fb6877b5d7c 56
miruga27 0:7fb6877b5d7c 57 /**
miruga27 0:7fb6877b5d7c 58 * Initializes the fuzzer for a test
miruga27 0:7fb6877b5d7c 59 *
miruga27 0:7fb6877b5d7c 60 * /param execKey Execution "Key" that initializes the random number generator uniquely for the test.
miruga27 0:7fb6877b5d7c 61 *
miruga27 0:7fb6877b5d7c 62 */
miruga27 0:7fb6877b5d7c 63 void SDLTest_FuzzerInit(Uint64 execKey);
miruga27 0:7fb6877b5d7c 64
miruga27 0:7fb6877b5d7c 65
miruga27 0:7fb6877b5d7c 66 /**
miruga27 0:7fb6877b5d7c 67 * Returns a random Uint8
miruga27 0:7fb6877b5d7c 68 *
miruga27 0:7fb6877b5d7c 69 * \returns Generated integer
miruga27 0:7fb6877b5d7c 70 */
miruga27 0:7fb6877b5d7c 71 Uint8 SDLTest_RandomUint8();
miruga27 0:7fb6877b5d7c 72
miruga27 0:7fb6877b5d7c 73 /**
miruga27 0:7fb6877b5d7c 74 * Returns a random Sint8
miruga27 0:7fb6877b5d7c 75 *
miruga27 0:7fb6877b5d7c 76 * \returns Generated signed integer
miruga27 0:7fb6877b5d7c 77 */
miruga27 0:7fb6877b5d7c 78 Sint8 SDLTest_RandomSint8();
miruga27 0:7fb6877b5d7c 79
miruga27 0:7fb6877b5d7c 80
miruga27 0:7fb6877b5d7c 81 /**
miruga27 0:7fb6877b5d7c 82 * Returns a random Uint16
miruga27 0:7fb6877b5d7c 83 *
miruga27 0:7fb6877b5d7c 84 * \returns Generated integer
miruga27 0:7fb6877b5d7c 85 */
miruga27 0:7fb6877b5d7c 86 Uint16 SDLTest_RandomUint16();
miruga27 0:7fb6877b5d7c 87
miruga27 0:7fb6877b5d7c 88 /**
miruga27 0:7fb6877b5d7c 89 * Returns a random Sint16
miruga27 0:7fb6877b5d7c 90 *
miruga27 0:7fb6877b5d7c 91 * \returns Generated signed integer
miruga27 0:7fb6877b5d7c 92 */
miruga27 0:7fb6877b5d7c 93 Sint16 SDLTest_RandomSint16();
miruga27 0:7fb6877b5d7c 94
miruga27 0:7fb6877b5d7c 95
miruga27 0:7fb6877b5d7c 96 /**
miruga27 0:7fb6877b5d7c 97 * Returns a random integer
miruga27 0:7fb6877b5d7c 98 *
miruga27 0:7fb6877b5d7c 99 * \returns Generated integer
miruga27 0:7fb6877b5d7c 100 */
miruga27 0:7fb6877b5d7c 101 Sint32 SDLTest_RandomSint32();
miruga27 0:7fb6877b5d7c 102
miruga27 0:7fb6877b5d7c 103
miruga27 0:7fb6877b5d7c 104 /**
miruga27 0:7fb6877b5d7c 105 * Returns a random positive integer
miruga27 0:7fb6877b5d7c 106 *
miruga27 0:7fb6877b5d7c 107 * \returns Generated integer
miruga27 0:7fb6877b5d7c 108 */
miruga27 0:7fb6877b5d7c 109 Uint32 SDLTest_RandomUint32();
miruga27 0:7fb6877b5d7c 110
miruga27 0:7fb6877b5d7c 111 /**
miruga27 0:7fb6877b5d7c 112 * Returns random Uint64.
miruga27 0:7fb6877b5d7c 113 *
miruga27 0:7fb6877b5d7c 114 * \returns Generated integer
miruga27 0:7fb6877b5d7c 115 */
miruga27 0:7fb6877b5d7c 116 Uint64 SDLTest_RandomUint64();
miruga27 0:7fb6877b5d7c 117
miruga27 0:7fb6877b5d7c 118
miruga27 0:7fb6877b5d7c 119 /**
miruga27 0:7fb6877b5d7c 120 * Returns random Sint64.
miruga27 0:7fb6877b5d7c 121 *
miruga27 0:7fb6877b5d7c 122 * \returns Generated signed integer
miruga27 0:7fb6877b5d7c 123 */
miruga27 0:7fb6877b5d7c 124 Sint64 SDLTest_RandomSint64();
miruga27 0:7fb6877b5d7c 125
miruga27 0:7fb6877b5d7c 126 /**
miruga27 0:7fb6877b5d7c 127 * \returns random float in range [0.0 - 1.0[
miruga27 0:7fb6877b5d7c 128 */
miruga27 0:7fb6877b5d7c 129 float SDLTest_RandomUnitFloat();
miruga27 0:7fb6877b5d7c 130
miruga27 0:7fb6877b5d7c 131 /**
miruga27 0:7fb6877b5d7c 132 * \returns random double in range [0.0 - 1.0[
miruga27 0:7fb6877b5d7c 133 */
miruga27 0:7fb6877b5d7c 134 double SDLTest_RandomUnitDouble();
miruga27 0:7fb6877b5d7c 135
miruga27 0:7fb6877b5d7c 136 /**
miruga27 0:7fb6877b5d7c 137 * \returns random float.
miruga27 0:7fb6877b5d7c 138 *
miruga27 0:7fb6877b5d7c 139 */
miruga27 0:7fb6877b5d7c 140 float SDLTest_RandomFloat();
miruga27 0:7fb6877b5d7c 141
miruga27 0:7fb6877b5d7c 142 /**
miruga27 0:7fb6877b5d7c 143 * \returns random double.
miruga27 0:7fb6877b5d7c 144 *
miruga27 0:7fb6877b5d7c 145 */
miruga27 0:7fb6877b5d7c 146 double SDLTest_RandomDouble();
miruga27 0:7fb6877b5d7c 147
miruga27 0:7fb6877b5d7c 148 /**
miruga27 0:7fb6877b5d7c 149 * Returns a random boundary value for Uint8 within the given boundaries.
miruga27 0:7fb6877b5d7c 150 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 151 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 152 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 153 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 154 *
miruga27 0:7fb6877b5d7c 155 * Usage examples:
miruga27 0:7fb6877b5d7c 156 * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
miruga27 0:7fb6877b5d7c 157 * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
miruga27 0:7fb6877b5d7c 158 * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 159 * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
miruga27 0:7fb6877b5d7c 160 *
miruga27 0:7fb6877b5d7c 161 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 162 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 163 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 164 *
miruga27 0:7fb6877b5d7c 165 * \returns Random boundary value for the given range and domain or 0 with error set
miruga27 0:7fb6877b5d7c 166 */
miruga27 0:7fb6877b5d7c 167 Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 168
miruga27 0:7fb6877b5d7c 169 /**
miruga27 0:7fb6877b5d7c 170 * Returns a random boundary value for Uint16 within the given boundaries.
miruga27 0:7fb6877b5d7c 171 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 172 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 173 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 174 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 175 *
miruga27 0:7fb6877b5d7c 176 * Usage examples:
miruga27 0:7fb6877b5d7c 177 * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
miruga27 0:7fb6877b5d7c 178 * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
miruga27 0:7fb6877b5d7c 179 * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 180 * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
miruga27 0:7fb6877b5d7c 181 *
miruga27 0:7fb6877b5d7c 182 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 183 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 184 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 185 *
miruga27 0:7fb6877b5d7c 186 * \returns Random boundary value for the given range and domain or 0 with error set
miruga27 0:7fb6877b5d7c 187 */
miruga27 0:7fb6877b5d7c 188 Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 189
miruga27 0:7fb6877b5d7c 190 /**
miruga27 0:7fb6877b5d7c 191 * Returns a random boundary value for Uint32 within the given boundaries.
miruga27 0:7fb6877b5d7c 192 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 193 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 194 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 195 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 196 *
miruga27 0:7fb6877b5d7c 197 * Usage examples:
miruga27 0:7fb6877b5d7c 198 * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
miruga27 0:7fb6877b5d7c 199 * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
miruga27 0:7fb6877b5d7c 200 * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 201 * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
miruga27 0:7fb6877b5d7c 202 *
miruga27 0:7fb6877b5d7c 203 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 204 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 205 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 206 *
miruga27 0:7fb6877b5d7c 207 * \returns Random boundary value for the given range and domain or 0 with error set
miruga27 0:7fb6877b5d7c 208 */
miruga27 0:7fb6877b5d7c 209 Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 210
miruga27 0:7fb6877b5d7c 211 /**
miruga27 0:7fb6877b5d7c 212 * Returns a random boundary value for Uint64 within the given boundaries.
miruga27 0:7fb6877b5d7c 213 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 214 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 215 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 216 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 217 *
miruga27 0:7fb6877b5d7c 218 * Usage examples:
miruga27 0:7fb6877b5d7c 219 * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
miruga27 0:7fb6877b5d7c 220 * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
miruga27 0:7fb6877b5d7c 221 * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 222 * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
miruga27 0:7fb6877b5d7c 223 *
miruga27 0:7fb6877b5d7c 224 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 225 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 226 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 227 *
miruga27 0:7fb6877b5d7c 228 * \returns Random boundary value for the given range and domain or 0 with error set
miruga27 0:7fb6877b5d7c 229 */
miruga27 0:7fb6877b5d7c 230 Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 231
miruga27 0:7fb6877b5d7c 232 /**
miruga27 0:7fb6877b5d7c 233 * Returns a random boundary value for Sint8 within the given boundaries.
miruga27 0:7fb6877b5d7c 234 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 235 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 236 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 237 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 238 *
miruga27 0:7fb6877b5d7c 239 * Usage examples:
miruga27 0:7fb6877b5d7c 240 * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
miruga27 0:7fb6877b5d7c 241 * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
miruga27 0:7fb6877b5d7c 242 * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 243 * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
miruga27 0:7fb6877b5d7c 244 *
miruga27 0:7fb6877b5d7c 245 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 246 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 247 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 248 *
miruga27 0:7fb6877b5d7c 249 * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
miruga27 0:7fb6877b5d7c 250 */
miruga27 0:7fb6877b5d7c 251 Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 252
miruga27 0:7fb6877b5d7c 253
miruga27 0:7fb6877b5d7c 254 /**
miruga27 0:7fb6877b5d7c 255 * Returns a random boundary value for Sint16 within the given boundaries.
miruga27 0:7fb6877b5d7c 256 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 257 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 258 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 259 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 260 *
miruga27 0:7fb6877b5d7c 261 * Usage examples:
miruga27 0:7fb6877b5d7c 262 * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
miruga27 0:7fb6877b5d7c 263 * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
miruga27 0:7fb6877b5d7c 264 * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 265 * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
miruga27 0:7fb6877b5d7c 266 *
miruga27 0:7fb6877b5d7c 267 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 268 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 269 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 270 *
miruga27 0:7fb6877b5d7c 271 * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
miruga27 0:7fb6877b5d7c 272 */
miruga27 0:7fb6877b5d7c 273 Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 274
miruga27 0:7fb6877b5d7c 275 /**
miruga27 0:7fb6877b5d7c 276 * Returns a random boundary value for Sint32 within the given boundaries.
miruga27 0:7fb6877b5d7c 277 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 278 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 279 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 280 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 281 *
miruga27 0:7fb6877b5d7c 282 * Usage examples:
miruga27 0:7fb6877b5d7c 283 * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
miruga27 0:7fb6877b5d7c 284 * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
miruga27 0:7fb6877b5d7c 285 * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 286 * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value)
miruga27 0:7fb6877b5d7c 287 *
miruga27 0:7fb6877b5d7c 288 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 289 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 290 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 291 *
miruga27 0:7fb6877b5d7c 292 * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
miruga27 0:7fb6877b5d7c 293 */
miruga27 0:7fb6877b5d7c 294 Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 295
miruga27 0:7fb6877b5d7c 296 /**
miruga27 0:7fb6877b5d7c 297 * Returns a random boundary value for Sint64 within the given boundaries.
miruga27 0:7fb6877b5d7c 298 * Boundaries are inclusive, see the usage examples below. If validDomain
miruga27 0:7fb6877b5d7c 299 * is true, the function will only return valid boundaries, otherwise non-valid
miruga27 0:7fb6877b5d7c 300 * boundaries are also possible.
miruga27 0:7fb6877b5d7c 301 * If boundary1 > boundary2, the values are swapped
miruga27 0:7fb6877b5d7c 302 *
miruga27 0:7fb6877b5d7c 303 * Usage examples:
miruga27 0:7fb6877b5d7c 304 * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
miruga27 0:7fb6877b5d7c 305 * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
miruga27 0:7fb6877b5d7c 306 * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
miruga27 0:7fb6877b5d7c 307 * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
miruga27 0:7fb6877b5d7c 308 *
miruga27 0:7fb6877b5d7c 309 * \param boundary1 Lower boundary limit
miruga27 0:7fb6877b5d7c 310 * \param boundary2 Upper boundary limit
miruga27 0:7fb6877b5d7c 311 * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
miruga27 0:7fb6877b5d7c 312 *
miruga27 0:7fb6877b5d7c 313 * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
miruga27 0:7fb6877b5d7c 314 */
miruga27 0:7fb6877b5d7c 315 Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
miruga27 0:7fb6877b5d7c 316
miruga27 0:7fb6877b5d7c 317
miruga27 0:7fb6877b5d7c 318 /**
miruga27 0:7fb6877b5d7c 319 * Returns integer in range [min, max] (inclusive).
miruga27 0:7fb6877b5d7c 320 * Min and max values can be negative values.
miruga27 0:7fb6877b5d7c 321 * If Max in smaller tham min, then the values are swapped.
miruga27 0:7fb6877b5d7c 322 * Min and max are the same value, that value will be returned.
miruga27 0:7fb6877b5d7c 323 *
miruga27 0:7fb6877b5d7c 324 * \param min Minimum inclusive value of returned random number
miruga27 0:7fb6877b5d7c 325 * \param max Maximum inclusive value of returned random number
miruga27 0:7fb6877b5d7c 326 *
miruga27 0:7fb6877b5d7c 327 * \returns Generated random integer in range
miruga27 0:7fb6877b5d7c 328 */
miruga27 0:7fb6877b5d7c 329 Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
miruga27 0:7fb6877b5d7c 330
miruga27 0:7fb6877b5d7c 331
miruga27 0:7fb6877b5d7c 332 /**
miruga27 0:7fb6877b5d7c 333 * Generates random null-terminated string. The minimum length for
miruga27 0:7fb6877b5d7c 334 * the string is 1 character, maximum length for the string is 255
miruga27 0:7fb6877b5d7c 335 * characters and it can contain ASCII characters from 32 to 126.
miruga27 0:7fb6877b5d7c 336 *
miruga27 0:7fb6877b5d7c 337 * Note: Returned string needs to be deallocated.
miruga27 0:7fb6877b5d7c 338 *
miruga27 0:7fb6877b5d7c 339 * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
miruga27 0:7fb6877b5d7c 340 */
miruga27 0:7fb6877b5d7c 341 char * SDLTest_RandomAsciiString();
miruga27 0:7fb6877b5d7c 342
miruga27 0:7fb6877b5d7c 343
miruga27 0:7fb6877b5d7c 344 /**
miruga27 0:7fb6877b5d7c 345 * Generates random null-terminated string. The maximum length for
miruga27 0:7fb6877b5d7c 346 * the string is defined by the maxLength parameter.
miruga27 0:7fb6877b5d7c 347 * String can contain ASCII characters from 32 to 126.
miruga27 0:7fb6877b5d7c 348 *
miruga27 0:7fb6877b5d7c 349 * Note: Returned string needs to be deallocated.
miruga27 0:7fb6877b5d7c 350 *
miruga27 0:7fb6877b5d7c 351 * \param maxLength The maximum length of the generated string.
miruga27 0:7fb6877b5d7c 352 *
miruga27 0:7fb6877b5d7c 353 * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
miruga27 0:7fb6877b5d7c 354 */
miruga27 0:7fb6877b5d7c 355 char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
miruga27 0:7fb6877b5d7c 356
miruga27 0:7fb6877b5d7c 357
miruga27 0:7fb6877b5d7c 358 /**
miruga27 0:7fb6877b5d7c 359 * Generates random null-terminated string. The length for
miruga27 0:7fb6877b5d7c 360 * the string is defined by the size parameter.
miruga27 0:7fb6877b5d7c 361 * String can contain ASCII characters from 32 to 126.
miruga27 0:7fb6877b5d7c 362 *
miruga27 0:7fb6877b5d7c 363 * Note: Returned string needs to be deallocated.
miruga27 0:7fb6877b5d7c 364 *
miruga27 0:7fb6877b5d7c 365 * \param size The length of the generated string
miruga27 0:7fb6877b5d7c 366 *
miruga27 0:7fb6877b5d7c 367 * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated.
miruga27 0:7fb6877b5d7c 368 */
miruga27 0:7fb6877b5d7c 369 char * SDLTest_RandomAsciiStringOfSize(int size);
miruga27 0:7fb6877b5d7c 370
miruga27 0:7fb6877b5d7c 371 /**
miruga27 0:7fb6877b5d7c 372 * Returns the invocation count for the fuzzer since last ...FuzzerInit.
miruga27 0:7fb6877b5d7c 373 */
miruga27 0:7fb6877b5d7c 374 int SDLTest_GetFuzzerInvocationCount();
miruga27 0:7fb6877b5d7c 375
miruga27 0:7fb6877b5d7c 376 /* Ends C function definitions when using C++ */
miruga27 0:7fb6877b5d7c 377 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 378 }
miruga27 0:7fb6877b5d7c 379 #endif
miruga27 0:7fb6877b5d7c 380 #include "close_code.h"
miruga27 0:7fb6877b5d7c 381
miruga27 0:7fb6877b5d7c 382 #endif /* _SDL_test_fuzzer_h */
miruga27 0:7fb6877b5d7c 383
miruga27 0:7fb6877b5d7c 384 /* vi: set ts=4 sw=4 expandtab: */