1 //
2 // This is a test of CxxTest's ValueTraits for enumerations.
3 //
4 #include <cxxtest/TestSuite.h>
6 //
7 // First define your enumeration
8 //
9 enum Answer {
10 Yes,
11 No,
12 Maybe,
13 DontKnow,
14 DontCare
15 };
17 //
18 // Now make CxxTest aware of it
19 //
20 CXXTEST_ENUM_TRAITS( Answer,
21 CXXTEST_ENUM_MEMBER( Yes )
22 CXXTEST_ENUM_MEMBER( No )
23 CXXTEST_ENUM_MEMBER( Maybe )
24 CXXTEST_ENUM_MEMBER( DontKnow )
25 CXXTEST_ENUM_MEMBER( DontCare ) );
27 class EnumTraits : public CxxTest::TestSuite
28 {
29 public:
30 void test_Enum_traits()
31 {
32 TS_FAIL( Yes );
33 TS_FAIL( No );
34 TS_FAIL( Maybe );
35 TS_FAIL( DontKnow );
36 TS_FAIL( DontCare );
37 TS_FAIL( (Answer)1000 );
38 }
39 };