Mercurial > sdl-ios-xcode
annotate test/automated/SDL_at.h @ 3719:15373e31daff gsoc2009_unit_tests
Moved some code around.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Tue, 07 Jul 2009 16:28:42 +0000 |
parents | 3c9d9c052c8f |
children | 6eca2af6a86b |
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 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
11 * @file SDL_at.h |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
12 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
13 * @brief Handles automatic testing functionality. |
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 * You create a testsuite and then run multiple testcases within that suite. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
16 * Syntax is similar to OpenGL. An example would be: |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
17 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
18 * @code |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
19 * int f; |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
20 * SDL_ATinit( "My testsuite" ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
21 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
22 * SDL_ATbegin( "My first testcase" ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
23 * if (!SDL_ATassert( "Trying '1+1=2'.", (1+1)==2)) |
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
3711
diff
changeset
|
24 * return; |
3711
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 * SDL_ATbegin( "My second testcase" ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
27 * if (!SDL_ATassert( "Trying '4/2=2'.", (4/2)==2)) |
3715
3c9d9c052c8f
Initial revision of SDL_Surface testsuite.
Edgar Simo <bobbens@gmail.com>
parents:
3711
diff
changeset
|
28 * return; |
3711
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 * f = SDL_ATend(); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
31 * @endcode |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
32 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
33 * @author Edgar Simo "bobbens" |
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 #ifndef _SDL_AT_H |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
38 # define _SDL_AT_H |
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 |
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 * Suite level actions. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
43 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
44 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
45 * @brief Starts the testsuite. |
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 * @param suite Name of the suite to start testing. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
48 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
49 void SDL_ATinit( const char *suite ); |
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 * @brief Finishes the testsuite printing out global results if verbose. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
52 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
53 * @param verbose Displays global results. |
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 int SDL_ATfinish( int verbose ); |
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 |
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 * Testcase level actions. |
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 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
62 * @brief Begins a testcase. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
63 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
64 * @param testcase Name of the testcase to begin. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
65 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
66 void SDL_ATbegin( const char *testcase ); |
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 * @brief Checks a condition in the testcase. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
69 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
70 * Will automatically call SDL_ATend if the condition isn't met. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
71 * |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
72 * @param msg Message to display for failure. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
73 * @param condition Condition to make sure is true. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
74 * @return Returns 1 if the condition isn't met. |
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 int SDL_ATassert( const char *msg, int condition ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
77 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
78 * @brief Ends a testcase. |
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 void SDL_ATend (void); |
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 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
83 /* |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
84 * Misc functions. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
85 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
86 /** |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
87 * @brief Prints some text. |
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 * @param msg printf formatted string to display. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
90 * @return Number of character printed. |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
91 */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
92 int SDL_ATprint( const char *msg, ... ); |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
93 |
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 #endif /* _SDL_AT_H */ |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
96 |
80839fc6b8e1
First revision of the automated test suite.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
97 |