Mercurial > sdl-ios-xcode
comparison test/automated/SDL_at.h @ 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 | 3c9d9c052c8f |
comparison
equal
deleted
inserted
replaced
3710:8600c345cd77 | 3711:80839fc6b8e1 |
---|---|
1 /* | |
2 * Common code for automated test suite. | |
3 * | |
4 * Written by Edgar Simo "bobbens" | |
5 * | |
6 * Released under Public Domain. | |
7 */ | |
8 | |
9 | |
10 /** | |
11 * @file SDL_at.h | |
12 * | |
13 * @brief Handles automatic testing functionality. | |
14 * | |
15 * You create a testsuite and then run multiple testcases within that suite. | |
16 * Syntax is similar to OpenGL. An example would be: | |
17 * | |
18 * @code | |
19 * int f; | |
20 * SDL_ATinit( "My testsuite" ); | |
21 * | |
22 * SDL_ATbegin( "My first testcase" ); | |
23 * if (!SDL_ATassert( "Trying '1+1=2'.", (1+1)==2)) | |
24 * SDL_ATend(); | |
25 * | |
26 * SDL_ATbegin( "My second testcase" ); | |
27 * if (!SDL_ATassert( "Trying '4/2=2'.", (4/2)==2)) | |
28 * SDL_ATend(); | |
29 * | |
30 * f = SDL_ATend(); | |
31 * @endcode | |
32 * | |
33 * @author Edgar Simo "bobbens" | |
34 */ | |
35 | |
36 | |
37 #ifndef _SDL_AT_H | |
38 # define _SDL_AT_H | |
39 | |
40 | |
41 /* | |
42 * Suite level actions. | |
43 */ | |
44 /** | |
45 * @brief Starts the testsuite. | |
46 * | |
47 * @param suite Name of the suite to start testing. | |
48 */ | |
49 void SDL_ATinit( const char *suite ); | |
50 /** | |
51 * @brief Finishes the testsuite printing out global results if verbose. | |
52 * | |
53 * @param verbose Displays global results. | |
54 */ | |
55 int SDL_ATfinish( int verbose ); | |
56 | |
57 | |
58 /* | |
59 * Testcase level actions. | |
60 */ | |
61 /** | |
62 * @brief Begins a testcase. | |
63 * | |
64 * @param testcase Name of the testcase to begin. | |
65 */ | |
66 void SDL_ATbegin( const char *testcase ); | |
67 /** | |
68 * @brief Checks a condition in the testcase. | |
69 * | |
70 * Will automatically call SDL_ATend if the condition isn't met. | |
71 * | |
72 * @param msg Message to display for failure. | |
73 * @param condition Condition to make sure is true. | |
74 * @return Returns 1 if the condition isn't met. | |
75 */ | |
76 int SDL_ATassert( const char *msg, int condition ); | |
77 /** | |
78 * @brief Ends a testcase. | |
79 */ | |
80 void SDL_ATend (void); | |
81 | |
82 | |
83 /* | |
84 * Misc functions. | |
85 */ | |
86 /** | |
87 * @brief Prints some text. | |
88 * | |
89 * @param msg printf formatted string to display. | |
90 * @return Number of character printed. | |
91 */ | |
92 int SDL_ATprint( const char *msg, ... ); | |
93 | |
94 | |
95 #endif /* _SDL_AT_H */ | |
96 | |
97 |