1 #include <cxxtest/TestSuite.h>
2 
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
10 
11 class GreenYellowRed : public CxxTest::TestSuite
12 {
13 public:
wait()14     void wait()
15     {
16         CXXTEST_SAMPLE_GUI_WAIT();
17     }
18 
test_Start_green()19     void test_Start_green()
20     {
21         wait();
22     }
23 
test_Green_again()24     void test_Green_again()
25     {
26         TS_TRACE("Still green");
27         wait();
28     }
29 
test_Now_yellow()30     void test_Now_yellow()
31     {
32         TS_WARN("Yellow");
33         wait();
34     }
35 
test_Cannot_go_back()36     void test_Cannot_go_back()
37     {
38         wait();
39     }
40 
test_Finally_red()41     void test_Finally_red()
42     {
43         TS_FAIL("Red");
44         wait();
45     }
46 
test_Cannot_go_back_to_yellow()47     void test_Cannot_go_back_to_yellow()
48     {
49         TS_WARN("Yellow?");
50         wait();
51     }
52 
test_Cannot_go_back_to_green()53     void test_Cannot_go_back_to_green()
54     {
55         wait();
56     }
57 };
58