Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00029 #ifndef CPPTEST_COLLECTOROUTPUT_H
00030 #define CPPTEST_COLLECTOROUTPUT_H
00031
00032 #include <list>
00033 #include <string>
00034 #include <vector>
00035
00036 #include "cpptest-output.h"
00037 #include "cpptest-source.h"
00038 #include "cpptest-time.h"
00039
00040 namespace Test
00041 {
00047 class CollectorOutput : public Output
00048 {
00049 public:
00050 virtual void finished(int tests, const Time& time);
00051 virtual void suite_start(int tests, const std::string& name);
00052 virtual void suite_end(int tests, const std::string& name,
00053 const Time& time);
00054 virtual void test_start(const std::string& name);
00055 virtual void test_end(const std::string& name, bool ok,
00056 const Time& time);
00057 virtual void assertment(const Source& s);
00058
00059 protected:
00060 struct OutputSuiteInfo;
00061 struct OutputTestInfo;
00062 struct OutputErrorTestInfo;
00063
00064 typedef std::list<Source> Sources;
00065
00066 struct TestInfo
00067 {
00068 std::string _name;
00069 Time _time;
00070
00071 bool _success : 1;
00072 Sources _sources;
00073
00074 explicit TestInfo(const std::string name);
00075 };
00076
00077 typedef std::vector<TestInfo> Tests;
00078
00079 struct SuiteInfo
00080 {
00081 std::string _name;
00082 int _errors;
00083 Tests _tests;
00084 Time _time;
00085
00086 SuiteInfo(const std::string& name, int tests);
00087 };
00088
00089 typedef std::list<SuiteInfo> Suites;
00090
00091 Suites _suites;
00092 int _total_errors;
00093 int _total_tests;
00094 Time _total_time;
00095
00096 CollectorOutput();
00097
00098 private:
00099 SuiteInfo* _cur_suite;
00100 TestInfo* _cur_test;
00101 };
00102
00103 }
00104
00105 #endif // #ifndef CPPTEST_COLLECTOROUTPUT_H
00106