1 #include <cxxtest/TestSuite.h>
3 #ifdef _WIN32
4 # include <windows.h>
5 # define CXXTEST_SAMPLE_GUI_WAIT() Sleep( 1000 )
6 #else // !_WIN32
7 extern "C" unsigned sleep( unsigned seconds );
8 # define CXXTEST_SAMPLE_GUI_WAIT() sleep( 1 )
9 #endif // _WIN32
11 class GreenYellowRed : public CxxTest::TestSuite
12 {
13 public:
14 void wait()
15 {
16 CXXTEST_SAMPLE_GUI_WAIT();
17 }
19 void test_Start_green()
20 {
21 wait();
22 }
24 void test_Green_again()
25 {
26 TS_TRACE( "Still green" );
27 wait();
28 }
30 void test_Now_yellow()
31 {
32 TS_WARN( "Yellow" );
33 wait();
34 }
36 void test_Cannot_go_back()
37 {
38 wait();
39 }
41 void test_Finally_red()
42 {
43 TS_FAIL( "Red" );
44 wait();
45 }
47 void test_Cannot_go_back_to_yellow()
48 {
49 TS_WARN( "Yellow?" );
50 wait();
51 }
53 void test_Cannot_go_back_to_green()
54 {
55 wait();
56 }
57 };