Mercurial > sdl-ios-xcode
annotate test/automated/testsdl.c @ 3636:e474a820daeb
Patched to compile.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 11 Jan 2010 07:33:56 +0000 |
parents | f638ded38b8a |
children | 1a99755b3b04 |
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 ); |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
96 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
97 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
98 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
|
99 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
|
100 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
101 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
102 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
|
103 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
|
104 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
105 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
106 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
|
107 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
|
108 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
109 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
110 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
|
111 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
|
112 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
113 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
114 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
|
115 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
|
116 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
117 } |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
118 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
|
119 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
|
120 continue; |
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
121 } |
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
|
122 |
3541
0c429a5fda8a
Added an automated test for rectangle routines, currently only testing line clipping.
Sam Lantinga <slouken@libsdl.org>
parents:
3482
diff
changeset
|
123 /* 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
|
124 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
|
125 exit(EXIT_FAILURE); |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } |
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 * @brief Main entry point. |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 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
|
133 { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 int failed; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 int rev; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 SDL_version ver; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 /* Get options. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 parse_options( argc, argv ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 /* Defaults. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 failed = 0; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 /* 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
|
145 SDL_GetVersion( &ver ); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 rev = SDL_GetRevision(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 SDL_ATprintVerbose( 1, "Running tests 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
|
148 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
|
149 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 /* Automatic tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 if (run_platform) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 failed += test_platform(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 if (run_rwops) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 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
|
155 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
|
156 failed += test_rect(); |
3259
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 if (run_surface) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 failed += test_surface(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 if (run_render) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 failed += test_render(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 if (run_audio) |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 failed += test_audio(); |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 /* Manual tests. */ |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 if (run_manual) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 } |
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 /* 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
|
169 if (failed > 0) { |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 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
|
171 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
|
172 SDL_ATprintErr( "System is running %s and is %s endian\n", |
3319 | 173 SDL_GetPlatform(), |
3482
78db4f7ae2f3
More fixes to compile under Visual C++
Sam Lantinga <slouken@libsdl.org>
parents:
3460
diff
changeset
|
174 #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
|
175 "little" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 #else |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 "big" |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 #endif |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 ); |
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 return failed; |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 } |
22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 |