comparison test/automated/SDL_at.h @ 3751:4a58821c9c98 gsoc2009_unit_tests

Improved developer documentation.
author Edgar Simo <bobbens@gmail.com>
date Wed, 05 Aug 2009 18:45:55 +0000
parents 9428ae743878
children
comparison
equal deleted inserted replaced
3750:cb75359d29bb 3751:4a58821c9c98
10 /** 10 /**
11 * @file SDL_at.h 11 * @file SDL_at.h
12 * 12 *
13 * @brief Handles automatic testing functionality. 13 * @brief Handles automatic testing functionality.
14 * 14 *
15 * You create a testsuite and then run multiple testcases within that suite. 15 * The basic approach with SDL_AT is to divide the tests into what are called
16 * test suites and test cases. Each test suite should have multiple test
17 * cases, each test case can have multiple asserts.
18 *
19 * To actually test for conditions within the testcase you check asserts, if
20 * the asserts fail the failures will be logged in the testsuite and
21 * displayed.
22 *
16 * Syntax is similar to OpenGL. An example would be: 23 * Syntax is similar to OpenGL. An example would be:
17 * 24 *
18 * @code 25 * @code
19 * int f; 26 * int f; // Number failed
20 * SDL_ATinit( "My testsuite" ); 27 * SDL_ATinit( "My testsuite" );
21 * 28 *
22 * SDL_ATbegin( "My first testcase" ); 29 * SDL_ATbegin( "My first testcase" );
23 * if (!SDL_ATassert( (1+1)==2, "Trying '1+1=2'.")) 30 * if (!SDL_ATassert( (1+1)==2, "Trying '1+1=2'."))
24 * return; 31 * return; // Implicitly calls SDL_ATend if assert fails
32 * SDL_ATend(); // Finish testcase
25 * 33 *
26 * SDL_ATbegin( "My second testcase" ); 34 * SDL_ATbegin( "My second testcase" );
27 * if (!SDL_ATassert( (4/2)==2, "Trying '4/2=2'.")) 35 * if (!SDL_ATassert( (4/2)==2, "Trying '4/2=2'."))
28 * return; 36 * return; // Implicitly calls SDL_ATend if assert fails
37 * SDL_ATend(); // Finish testcase
29 * 38 *
30 * f = SDL_ATend(); 39 * f = SDL_ATfinish();
31 * @endcode 40 * @endcode
32 * 41 *
33 * @author Edgar Simo "bobbens" 42 * @author Edgar Simo "bobbens"
34 */ 43 */
35 44
38 # define _SDL_AT_H 47 # define _SDL_AT_H
39 48
40 49
41 50
42 enum { 51 enum {
43 SDL_AT_VERBOSE, 52 SDL_AT_VERBOSE, /**< Sets the verbose level. */
44 SDL_AT_QUIET 53 SDL_AT_QUIET /**< Sets quietness. */
45 }; 54 };
46 55
47 56
48 /* 57 /*
49 * Suite level actions. 58 * Suite level actions.
55 */ 64 */
56 void SDL_ATinit( const char *suite ); 65 void SDL_ATinit( const char *suite );
57 /** 66 /**
58 * @brief Finishes the testsuite printing out global results if verbose. 67 * @brief Finishes the testsuite printing out global results if verbose.
59 * 68 *
60 * @param verbose Displays global results. 69 * @return 0 if no errors occurred, otherwise number of failures.
61 */ 70 */
62 int SDL_ATfinish (void); 71 int SDL_ATfinish (void);
63 /** 72 /**
64 * @brief Sets a global property value. 73 * @brief Sets a global property value.
65 * 74 *