Debian Codegraph @

src/test/test.cpp

raw
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libqxp project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #include <iostream>
11
12 #include <cppunit/BriefTestProgressListener.h>
13 #include <cppunit/CompilerOutputter.h>
14 #include <cppunit/TestResult.h>
15 #include <cppunit/TestResultCollector.h>
16 #include <cppunit/TestRunner.h>
17
18 #include <cppunit/extensions/TestFactoryRegistry.h>
19
20 int main()
21 {
22 // Create the event manager and test controller
23 CPPUNIT_NS::TestResult controller;
24
25 // Add a listener that colllects test result
26 CPPUNIT_NS::TestResultCollector result;
27 controller.addListener(&result);
28
29 // Add a listener that print dots as test run.
30 CPPUNIT_NS::BriefTestProgressListener progress;
31 controller.addListener(&progress);
32
33 // Add the top suite to the test runner
34 CPPUNIT_NS::TestRunner runner;
35 runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
36 runner.run(controller);
37
38 // output
39 CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr);
40 outputter.write();
41
42 // return status code
43 return result.wasSuccessful() ? 0 : 1;
44 }
45
46 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */