PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/extlibs/UnitTest++/source/tests/TestTestList.cpp

https://bitbucket.org/hugoruscitti/pilascpp
C++ | 50 lines | 37 code | 13 blank | 0 comment | 8 complexity | f40cdc00e2bc87351bc6b4cbba22e581 MD5 | raw file
 1#include "../UnitTest++.h"
 2#include "../TestList.h"
 3
 4using namespace UnitTest;
 5
 6namespace {
 7
 8
 9TEST (TestListIsEmptyByDefault)
10{
11    TestList list;
12    CHECK (list.GetHead() == 0);
13}
14
15TEST (AddingTestSetsHeadToTest)
16{
17    Test test("test");
18    TestList list;
19    list.Add(&test);
20
21    CHECK (list.GetHead() == &test);
22    CHECK (test.next == 0);
23}
24
25TEST (AddingSecondTestAddsItToEndOfList)
26{
27    Test test1("test1");
28    Test test2("test2");
29
30    TestList list;
31    list.Add(&test1);
32    list.Add(&test2);
33
34    CHECK (list.GetHead() == &test1);
35    CHECK (test1.next == &test2);
36    CHECK (test2.next == 0);
37}
38
39TEST (ListAdderAddsTestToList)
40{
41    TestList list;
42
43    Test test("");    
44    ListAdder adder(list, &test);
45
46    CHECK (list.GetHead() == &test);
47    CHECK (test.next == 0);
48}
49
50}