Mercurial > sdl-ios-xcode
annotate test/automated/SDL_at.c @ 3711:80839fc6b8e1 gsoc2009_unit_tests
First revision of the automated test suite.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Fri, 19 Jun 2009 18:53:58 +0000 |
parents | |
children | a34bab848c7e |
rev | line source |
---|---|
3711
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
1 /* |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
2 * Common code for automated test suite. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
3 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
4 * Written by Edgar Simo "bobbens" |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
5 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
6 * Released under Public Domain. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
7 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
8 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
9 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
10 #include "SDL_at.h" |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
11 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
12 #include <stdio.h> |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
13 #include <stdarg.h> |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
14 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
15 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
16 /* |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
17 * Internal usage SDL_AT variables. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
18 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
19 static const char *at_suite_msg = NULL; /**< Testsuite message. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
20 static const char *at_test_msg = NULL; /**< Testcase message. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
21 static int at_success = 0; /**< Number of successful testcases. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
22 static int at_failure = 0; /**< Number of failed testcases. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
23 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
24 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
25 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
26 * @brief Cleans up the automated testsuite state. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
27 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
28 static void SDL_ATcleanup (void) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
29 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
30 at_suite_msg = NULL; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
31 at_test_msg = NULL; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
32 at_success = 0; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
33 at_failure = 0; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
34 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
35 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
36 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
37 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
38 * @brief Begin testsuite. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
39 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
40 void SDL_ATinit( const char *suite ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
41 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
42 /* Do not open twice. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
43 if (at_suite_msg) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
44 SDL_ATprint( "AT suite '%s' not closed before opening suite '%s'\n", |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
45 at_suite_msg, suite ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
46 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
47 /* Must have a name. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
48 if (suite == NULL) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
49 SDL_ATprint( "AT testsuite does not have a name.\n"); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
50 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
51 SDL_ATcleanup(); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
52 at_suite_msg = suite; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
53 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
54 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
55 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
56 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
57 * @brief Finish testsuite. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
58 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
59 int SDL_ATfinish( int verbose ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
60 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
61 int failed; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
62 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
63 /* Make sure initialized. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
64 if (at_suite_msg == NULL) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
65 SDL_ATprint("Ended testcase without initializing.\n"); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
66 return; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
67 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
68 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
69 /* Display message if verbose on failed. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
70 failed = at_failure; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
71 if (verbose) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
72 if (at_failure > 0) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
73 SDL_ATprint( "%s : Failed %d out of %d testcases!\n", |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
74 at_suite_msg, at_failure, at_success ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
75 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
76 else { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
77 SDL_ATprint( "%s : All tests successful (%d)\n", |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
78 at_suite_msg, at_success ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
79 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
80 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
81 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
82 /* Clean up. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
83 SDL_ATcleanup(); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
84 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
85 /* Return failed. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
86 return failed; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
87 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
88 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
89 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
90 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
91 * @brief Begin testcase. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
92 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
93 void SDL_ATbegin( const char *testcase ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
94 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
95 /* Do not open twice. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
96 if (at_test_msg) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
97 SDL_ATprint( "AT testcase '%s' not closed before opening testcase '%s'", |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
98 at_test_msg, testcase ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
99 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
100 /* Must have a name. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
101 if (testcase == NULL) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
102 SDL_ATprint( "AT testcase does not have a name."); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
103 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
104 at_test_msg = testcase; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
105 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
106 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
107 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
108 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
109 * @brief Ends the testcase with a succes or failure. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
110 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
111 static void SDL_ATendWith( int success ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
112 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
113 /* Make sure initialized. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
114 if (at_test_msg == NULL) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
115 SDL_ATprint("Ended testcase without initializing."); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
116 return; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
117 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
118 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
119 /* Mark as success or failure. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
120 if (success) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
121 at_success++; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
122 else |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
123 at_failure++; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
124 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
125 /* Clean up. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
126 at_test_msg = NULL; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
127 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
128 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
129 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
130 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
131 * @brief Testcase test. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
132 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
133 int SDL_ATassert( const char *msg, int condition ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
134 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
135 /* Condition failed. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
136 if (!condition) { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
137 SDL_ATprint( "%s [%s] : %s", at_suite_msg, at_test_msg, msg ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
138 SDL_ATendWith(0); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
139 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
140 return !condition; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
141 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
142 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
143 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
144 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
145 * @brief End testcase. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
146 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
147 void SDL_ATend (void) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
148 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
149 SDL_ATendWith(1); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
150 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
151 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
152 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
153 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
154 * @brief Displays a message. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
155 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
156 int SDL_ATprint( const char *msg, ... ) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
157 { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
158 va_list ap; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
159 int ret; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
160 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
161 /* Make sure there is something to print. */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
162 if (msg == NULL) |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
163 return; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
164 else { |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
165 va_start(ap, msg); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
166 ret = vprintf(msg, ap); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
167 va_end(ap); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
168 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
169 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
170 return ret; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
171 } |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
172 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
173 |