Hash :
449ef08d
        
        Author :
  
        
        Date :
2021-12-21T14:24:20
        
      
minimal fixes to visual test, so that it actually builds w/o warnings: - linux_process.c: add an SDLVisualTest_ScreenshotProcess() stub for linux builds succeed. - action_configparser.c: fixes -Wswitch warnings. - testharness.c: fixes 'is used uninitialized' warnings for userevents. - testharness.c: fixes format string argument to 'Force killing...' - testquit.c: fix type of options array in main(). - windows_screenshot.c: lowercase windows.h header name. - ran dos2unix on all sources and add missing newlines at files' ends. - minor adjustments to autotools build system (which actually seems to need more surgery for unnecessary stuff...)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
/* See LICENSE.txt for the full license governing this code. */
/**
 * \file variators.c
 *
 * Source file for the operations that act on variators.
 */
#include <SDL_test.h>
#include "SDL_visualtest_variators.h"
int
SDLVisualTest_InitVariator(SDLVisualTest_Variator* variator,
                           SDLVisualTest_SUTConfig* config,
                           SDLVisualTest_VariatorType type,
                           Uint64 seed)
{
    if(!variator)
    {
        SDLTest_LogError("variator argument cannot be NULL");
        return 0;
    }
    if(!config)
    {
        SDLTest_LogError("config argument cannot be NULL");
        return 0;
    }
    variator->type = type;
    switch(type)
    {
        case SDL_VARIATOR_EXHAUSTIVE:
            return SDLVisualTest_InitExhaustiveVariator(&variator->data.exhaustive,
                                                        config);
        break;
        case SDL_VARIATOR_RANDOM:
            return SDLVisualTest_InitRandomVariator(&variator->data.random,
                                                    config, seed);
        break;
        default:
            SDLTest_LogError("Invalid value for variator type");
            return 0;
    }
    return 0;
}
char*
SDLVisualTest_GetNextVariation(SDLVisualTest_Variator* variator)
{
    if(!variator)
    {
        SDLTest_LogError("variator argument cannot be NULL");
        return NULL;
    }
    switch(variator->type)
    {
        case SDL_VARIATOR_EXHAUSTIVE:
            return SDLVisualTest_GetNextExhaustiveVariation(&variator->data.exhaustive);
        break;
        case SDL_VARIATOR_RANDOM:
            return SDLVisualTest_GetNextRandomVariation(&variator->data.random);
        break;
        default:
            SDLTest_LogError("Invalid value for variator type");
            return NULL;
    }
    return NULL;
}
void SDLVisualTest_FreeVariator(SDLVisualTest_Variator* variator)
{
    if(!variator)
    {
        SDLTest_LogError("variator argument cannot be NULL");
        return;
    }
    switch(variator->type)
    {
        case SDL_VARIATOR_EXHAUSTIVE:
            SDLVisualTest_FreeExhaustiveVariator(&variator->data.exhaustive);
        break;
        case SDL_VARIATOR_RANDOM:
            SDLVisualTest_FreeRandomVariator(&variator->data.random);
        break;
        default:
            SDLTest_LogError("Invalid value for variator type");
    }
}