testprograms: parse arguments using SDLTest_CommonState

This commit is contained in:
Anonymous Maarten 2023-03-17 00:25:39 +01:00 committed by Anonymous Maarten
parent 8bea41f737
commit 4a6528e3f0
71 changed files with 1516 additions and 389 deletions

View file

@ -12,6 +12,7 @@
*/
#include "../src/SDL_internal.h"
#include <SDL3/SDL_test.h>
#include <stdio.h>
#include <string.h>
@ -1038,5 +1039,22 @@ run_test(void)
int main(int argc, char *argv[])
{
return run_test() ? 0 : 1;
int result;
SDLTest_CommonState *state;
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, 0);
if (state == NULL) {
return 1;
}
/* Parse commandline */
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
return 1;
}
result = run_test() ? 0 : 1;
SDLTest_CommonDestroyState(state);
return result;
}