annotate test/automated/testsdl.c @ 4619:b9a205e6369f

Moved brace to the beginning of the line for the beginning of functions
author Sam Lantinga <slouken@libsdl.org>
date Wed, 28 Jul 2010 01:05:58 -0700
parents c84712de8433
children
rev   line source
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * SDL test suite framework code.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 *
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 * Written by Edgar Simo "bobbens"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 *
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 * Released under Public Domain.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 #include "SDL.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 #include "SDL_at.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 #include "platform/platform.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 #include "rwops/rwops.h"
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
14 #include "rect/rect.h"
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 #include "surface/surface.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 #include "render/render.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 #include "audio/audio.h"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
3482
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
19 #if defined(WIN32)
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
20 #define NO_GETOPT
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
21 #endif
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
22 #if defined(__QNXNTO__)
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
23 #define NO_GETOPT_LONG 1
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
24 #endif /* __QNXNTO__ */
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
25
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include <stdio.h> /* printf */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include <stdlib.h> /* exit */
3482
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
28 #ifndef NO_GETOPT
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include <unistd.h> /* getopt */
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
30 #if !defined(NO_GETOPT_LONG)
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <getopt.h> /* getopt_long */
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
32 #endif /* !NO_GETOPT_LONG */
3482
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
33 #endif /* !NO_GETOPT */
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 /*
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 * Tests to run.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 static int run_manual = 0; /**< Run manual tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 /* Manual. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 /* Automatic. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 static int run_platform = 1; /**< Run platform tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 static int run_rwops = 1; /**< Run RWops tests. */
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
44 static int run_rect = 1; /**< Run rect tests. */
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 static int run_surface = 1; /**< Run surface tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 static int run_render = 1; /**< Run render tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 static int run_audio = 1; /**< Run audio tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 /*
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 * Prototypes.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 static void print_usage( const char *name );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 static void parse_options( int argc, char *argv[] );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 /**
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 * @brief Displays program usage.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 */
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
59 static void print_usage( const char *name )
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
60 {
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
61 printf("Usage: %s [OPTIONS]\n", name);
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
62 printf("Options are:\n");
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
63 printf(" -m, --manual enables tests that require user interaction\n");
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
64 printf(" --noplatform do not run the platform tests\n");
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
65 printf(" --norwops do not run the rwops tests\n");
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
66 printf(" --norect do not run the rect tests\n");
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
67 printf(" --nosurface do not run the surface tests\n");
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
68 printf(" --norender do not run the render tests\n");
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
69 printf(" --noaudio do not run the audio tests\n");
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
70 printf(" -v, --verbose increases verbosity level by 1 for each -v\n");
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
71 printf(" -q, --quiet only displays errors\n");
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
72 printf(" -h, --help display this message and exit\n");
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
73 }
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 /**
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 * @brief Handles the options.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 static void parse_options( int argc, char *argv[] )
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 {
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 int i;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
82 for (i = 1; i < argc; ++i) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
83 const char *arg = argv[i];
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
84 if (SDL_strcmp(arg, "-m") == 0 || SDL_strcmp(arg, "--manual") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
85 run_manual = 1;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
86 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
87 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
88 if (SDL_strcmp(arg, "-v") == 0 || SDL_strcmp(arg, "--verbose") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
89 int level;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
90 SDL_ATgeti( SDL_AT_VERBOSE, &level );
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
91 SDL_ATseti( SDL_AT_VERBOSE, level+1 );
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
92 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
93 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
94 if (SDL_strcmp(arg, "-q") == 0 || SDL_strcmp(arg, "--quiet") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
95 SDL_ATseti( SDL_AT_QUIET, 1 );
3658
1a99755b3b04 Quiet tests shouldn't prompt during assertions
Sam Lantinga <slouken@libsdl.org>
parents: 3596
diff changeset
96 SDL_setenv("SDL_ASSERT", "abort", 0);
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
97 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
98 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
99 if (SDL_strcmp(arg, "--noplatform") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
100 run_platform = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
101 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
102 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
103 if (SDL_strcmp(arg, "--norwops") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
104 run_rwops = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
105 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
106 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
107 if (SDL_strcmp(arg, "--norect") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
108 run_rect = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
109 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
110 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
111 if (SDL_strcmp(arg, "--nosurface") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
112 run_surface = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
113 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
114 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
115 if (SDL_strcmp(arg, "--norender") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
116 run_render = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
117 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
118 }
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
119 if (SDL_strcmp(arg, "--noaudio") == 0) {
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
120 run_audio = 0;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
121 continue;
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
122 }
3460
ba48701b0534 Added support for generic getopt() function instead of getopt_long(). Because not all platforms have getopt_long().
Mike Gorchak <lestat@i.com.ua>
parents: 3319
diff changeset
123
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
124 /* Print help and exit! */
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
125 print_usage( argv[0] );
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
126 exit(EXIT_FAILURE);
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 }
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 }
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 /**
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 * @brief Main entry point.
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 int main( int argc, char *argv[] )
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 {
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 int failed;
4478
c84712de8433 Fixed revision type for SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 3658
diff changeset
136 const char *rev;
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 SDL_version ver;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 /* Get options. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 parse_options( argc, argv );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 /* Defaults. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 failed = 0;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 /* Print some text if verbose. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 SDL_GetVersion( &ver );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 rev = SDL_GetRevision();
4478
c84712de8433 Fixed revision type for SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 3658
diff changeset
148 SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %s\n",
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 ver.major, ver.minor, ver.patch, rev );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 /* Automatic tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 if (run_platform)
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 failed += test_platform();
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 if (run_rwops)
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 failed += test_rwops();
3541
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
156 if (run_rect)
0c429a5fda8a Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents: 3482
diff changeset
157 failed += test_rect();
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 if (run_surface)
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 failed += test_surface();
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 if (run_render)
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 failed += test_render();
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 if (run_audio)
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 failed += test_audio();
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 /* Manual tests. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 if (run_manual) {
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 }
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 /* Display more information if failed. */
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 if (failed > 0) {
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n",
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 ver.major, ver.minor, ver.patch, rev );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 SDL_ATprintErr( "System is running %s and is %s endian\n",
3319
63d4517fc4ac Fixed bug #777
Sam Lantinga <slouken@libsdl.org>
parents: 3259
diff changeset
174 SDL_GetPlatform(),
3482
78db4f7ae2f3 More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents: 3460
diff changeset
175 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3259
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 "little"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 #else
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 "big"
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 #endif
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 );
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 }
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 return failed;
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 }
22ac66da0765 Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185