1 #ifndef __SIMPLETEST_H
2 #define __SIMPLETEST_H
4 #include <cxxtest/TestSuite.h>
6 //
7 // A simple test suite: Just inherit CxxTest::TestSuite and write tests!
8 //
10 class SimpleTest : public CxxTest::TestSuite
11 {
12 public:
13 void testEquality()
14 {
15 TS_ASSERT_EQUALS( 1, 1 );
16 TS_ASSERT_EQUALS( 1, 2 );
17 TS_ASSERT_EQUALS( 'a', 'A' );
18 TS_ASSERT_EQUALS( 1.0, -12345678900000000000000000000000000000000000000000.1234 );
19 }
21 void testAddition()
22 {
23 TS_ASSERT_EQUALS( 1 + 1, 2 );
24 TS_ASSERT_EQUALS( 2 + 2, 5 );
25 }
27 void TestMultiplication()
28 {
29 TS_ASSERT_EQUALS( 2 * 2, 4 );
30 TS_ASSERT_EQUALS( 4 * 4, 44 );
31 TS_ASSERT_DIFFERS( -2 * -2, 4 );
32 }
34 void testComparison()
35 {
36 TS_ASSERT_LESS_THAN( (int)1, (unsigned long)2 );
37 TS_ASSERT_LESS_THAN( -1, -2 );
38 }
40 void testTheWorldIsCrazy()
41 {
42 TS_ASSERT_EQUALS( true, false );
43 }
45 void test_Failure()
46 {
47 TS_FAIL( "Not implemented" );
48 TS_FAIL( 1569779912 );
49 }
51 void test_TS_WARN_macro()
52 {
53 TS_WARN( "Just a friendly warning" );
54 TS_WARN( "Warnings don't abort the test" );
55 }
56 };
59 #endif // __SIMPLETEST_H