PageRenderTime 12ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/sparrowhawk/foundation/unit_tests/ESFListTestMain.cpp

http://github.com/jtblatt/duderino
C++ | 75 lines | 41 code | 19 blank | 15 comment | 10 complexity | c4818d8cd0da7424a6e9eefd1b94a253 MD5 | raw file
 1/*
 2 *  Copyright 2005 Joshua Blatt, Yahoo! Inc.
 3 *
 4 *  Licensed under the Apache License, Version 2.0 (the "License");
 5 *  you may not use this file except in compliance with the License.
 6 *  You may obtain a copy of the License at
 7 *
 8 *      http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16
17#ifndef ESTF_CONCURRENCY_DECORATOR_H
18#include <ESTFConcurrencyDecorator.h>
19#endif
20
21#ifndef ESTF_REPETITION_DECORATOR_H
22#include <ESTFRepetitionDecorator.h>
23#endif
24
25#ifndef ESTF_RESULT_COLLECTOR_H
26#include <ESTFResultCollector.h>
27#endif
28
29#ifndef ESTF_COMPOSITE_H
30#include <ESTFComposite.h>
31#endif
32
33#ifndef ESTF_ASSERT_H
34#include <ESTFAssert.h>
35#endif
36
37#ifndef ESF_LIST_TEST_H
38#include <ESFListTest.h>
39#endif
40
41int main() {
42    ESFListTestPtr listTest = new ESFListTest();
43
44    ESTFConcurrencyDecoratorPtr listDecorator = new ESTFConcurrencyDecorator(listTest, 3);
45
46    ESTFCompositePtr testSuite = new ESTFComposite();
47
48    testSuite->add(listDecorator);
49
50    ESTFRepetitionDecoratorPtr root = new ESTFRepetitionDecorator(testSuite, 3);
51
52    ESTFResultCollector collector;
53
54    if (false == root->setup()) {
55        cerr << "Testing framework setup failed" << endl;
56        return 1;
57    }
58
59    if (false == root->run(&collector)) {
60        cerr << "Testing framework run failed" << endl;
61    }
62
63    if (false == root->tearDown()) {
64        cerr << "Testing framework tear down failed" << endl;
65    }
66
67    if (0 == collector.getFailureCount() && 0 == collector.getErrorCount()) {
68        cout << "All test cases passed" << endl;
69    }
70
71    cout << collector << endl;
72
73    return 0;
74}
75