1 /* See COPYING.txt for the full license governing this code. */ 2 /** 3 * \file SDL_visualtest_exhaustive_variator.h 4 * 5 * Header for the exhaustive variator. 6 */ 7 8 #include "SDL_visualtest_harness_argparser.h" 9 #include "SDL_visualtest_variator_common.h" 10 11 #ifndef _SDL_visualtest_exhaustive_variator_h 12 #define _SDL_visualtest_exhaustive_variator_h 13 14 /* Set up for C function definitions, even when using C++ */ 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** 20 * Struct for the variator that exhaustively iterates through all variations of 21 * command line arguments to the SUT. 22 */ 23 typedef struct SDLVisualTest_ExhaustiveVariator 24 { 25 /*! The current variation. */ 26 SDLVisualTest_Variation variation; 27 /*! Configuration object for the SUT that the variator is running for. */ 28 SDLVisualTest_SUTConfig config; 29 /*! Buffer to store the arguments string built from the variation */ 30 char buffer[MAX_SUT_ARGS_LEN]; 31 } SDLVisualTest_ExhaustiveVariator; 32 33 /** 34 * Initializes the variator. 35 * 36 * \return 1 on success, 0 on failure 37 */ 38 int SDLVisualTest_InitExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator, 39 SDLVisualTest_SUTConfig* config); 40 41 /** 42 * Gets the arguments string for the next variation using the variator and updates 43 * the variator's current variation object to the next variation. 44 * 45 * \return The arguments string representing the next variation on success, and 46 * NULL on failure or if we have iterated through all possible variations. 47 * In the latter case subsequent calls will start the variations again from 48 * the very beginning. The pointer returned should not be freed. 49 */ 50 char* SDLVisualTest_GetNextExhaustiveVariation(SDLVisualTest_ExhaustiveVariator* variator); 51 52 /** 53 * Frees any resources associated with the variator. 54 */ 55 void SDLVisualTest_FreeExhaustiveVariator(SDLVisualTest_ExhaustiveVariator* variator); 56 57 /* Ends C function definitions when using C++ */ 58 #ifdef __cplusplus 59 } 60 #endif 61 62 #endif /* _SDL_visualtest_exhaustive_variator_h */