~laney/ubuntu/vivid/0ad/test

« back to all changes in this revision

Viewing changes to libraries/source/cxxtest-4.3/test/GoodSuite.h

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-05-17 16:30:39 UTC
  • mfrom: (5.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20140517163039-whlz3xf64hbmi8x1
Tags: 0.0.16-1
* New upstream release.
  - Drop debian/patches/fix-kfreebsd-ftbfs.patch; applied upstream.
* Avoid repacking tarball by including missing jquery sources in Debian diff,
  see debian/missing-sources/jquery-1.8.{0,3}.js. Alternative way of fixing
  #735349.
  - Update debian/copyright to include missing license entries for the
    various javascript libraries contained in the source tarball.
  - Revert changes made to debian/control in 0ad/0.0.15+dfsg-3, i.e.:
    revert: debian/control: Hardcode versions of 0ad-data{,-common} to
            depend on to workaround the fact that 0.0.15+dfsg is strictly
            greater than 0.0.15.
* Build-dep on libgloox-dev (>= 1.0.9) to ensure that 0ad is built with
  newer enough gloox to avoid lobby connectivity issues.
* Add new build-deps: libicu-dev, libmozjs-24-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <cxxtest/TestSuite.h>
 
2
#include <math.h>
 
3
 
 
4
//
 
5
// This is a test suite in which all tests pass.
 
6
// It is also an example of all the TS[M]_ macros except TS_FAIL()
 
7
//
 
8
 
 
9
class GoodSuite : public CxxTest::TestSuite
 
10
{
 
11
public:
 
12
    void testAssert()
 
13
    {
 
14
        TS_ASSERT(true);
 
15
        TS_ASSERT(1 == 1);
 
16
        TS_ASSERT(13);
 
17
        TS_ASSERT(this);
 
18
    }
 
19
 
 
20
    void testAssertMessage()
 
21
    {
 
22
        TSM_ASSERT("ASCII works", 'A' == 65);
 
23
    }
 
24
 
 
25
    void testEquals()
 
26
    {
 
27
        TS_ASSERT_EQUALS(1 + 1, 2);
 
28
        TS_ASSERT_EQUALS(2 * 2, 4);
 
29
        TS_ASSERT_EQUALS(-4 * -4, 16);
 
30
    }
 
31
 
 
32
    void testEqualsMessage()
 
33
    {
 
34
        TSM_ASSERT_EQUALS("Addition operator works", 1 + 1, 2);
 
35
    }
 
36
 
 
37
    void testDelta()
 
38
    {
 
39
        TS_ASSERT_DELTA(1.0 + 1.0, 2.0, 0.0001);
 
40
    }
 
41
 
 
42
    void testDeltaMessage()
 
43
    {
 
44
        TSM_ASSERT_DELTA("sqrt() works", sqrt(2.0), 1.4142, 0.0001);
 
45
    }
 
46
 
 
47
    void testDiffers()
 
48
    {
 
49
        TS_ASSERT_DIFFERS(0, 1);
 
50
        TS_ASSERT_DIFFERS(0.12, 0.123);
 
51
    }
 
52
 
 
53
    void testDiffersMessage()
 
54
    {
 
55
        TSM_ASSERT_DIFFERS("Not all is true", 0, 1);
 
56
    }
 
57
 
 
58
    void testLessThan()
 
59
    {
 
60
        TS_ASSERT_LESS_THAN(1, 2);
 
61
        TS_ASSERT_LESS_THAN(-2, -1);
 
62
    }
 
63
 
 
64
    void testLessThanMessage()
 
65
    {
 
66
        TSM_ASSERT_LESS_THAN(".5 is less than its square root", 0.5, sqrt(0.5));
 
67
    }
 
68
 
 
69
    void testLessThanEquals()
 
70
    {
 
71
        TS_ASSERT_LESS_THAN_EQUALS(3, 3);
 
72
        TS_ASSERT_LESS_THAN_EQUALS(3, 4);
 
73
    }
 
74
 
 
75
    void testLessThanEqualsMessage()
 
76
    {
 
77
        TSM_ASSERT_LESS_THAN_EQUALS("1.0 <= its square root", 1.0, sqrt(1.0));
 
78
    }
 
79
 
 
80
    void testThrows()
 
81
    {
 
82
        TS_ASSERT_THROWS( { throw 1; }, int);
 
83
    }
 
84
 
 
85
    void testThrowsMessage()
 
86
    {
 
87
        TSM_ASSERT_THROWS("1 is an integer", { throw 1; }, int);
 
88
    }
 
89
 
 
90
    void testThrowsAnything()
 
91
    {
 
92
        TS_ASSERT_THROWS_ANYTHING( { throw GoodSuite(); });
 
93
    }
 
94
 
 
95
    void testThrowsAnythingMessage()
 
96
    {
 
97
        TSM_ASSERT_THROWS_ANYTHING("Yes, you can throw test suites",
 
98
        { throw GoodSuite(); });
 
99
    }
 
100
 
 
101
    void testThrowsNothing()
 
102
    {
 
103
        TS_ASSERT_THROWS_NOTHING(throwNothing());
 
104
    }
 
105
 
 
106
    void testThrowsNothingMessage()
 
107
    {
 
108
        TSM_ASSERT_THROWS_NOTHING("Empty functions dosn't throw", throwNothing());
 
109
    }
 
110
 
 
111
    void throwNothing()
 
112
    {
 
113
    }
 
114
};