hayai_outputter.hpp
Go to the documentation of this file.
00001 #ifndef __HAYAI_OUTPUTTER
00002 #define __HAYAI_OUTPUTTER
00003 #include <iostream>
00004 #include <cstddef>
00005 
00006 #include "hayai/hayai_test_result.hpp"
00007 
00008 
00009 namespace hayai
00010 {
00012 
00014     class Outputter
00015     {
00016     public:
00018 
00024         virtual void Begin(const std::size_t& enabledCount,
00025                            const std::size_t& disabledCount) = 0;
00026 
00027 
00029 
00033         virtual void End(const std::size_t& executedCount,
00034                          const std::size_t& disabledCount) = 0;
00035 
00036 
00038 
00044         virtual void BeginTest(const std::string& fixtureName,
00045                                const std::string& testName,
00046                                const TestParametersDescriptor& parameters,
00047                                const std::size_t& runsCount,
00048                                const std::size_t& iterationsCount) = 0;
00049 
00050 
00052 
00057         virtual void EndTest(const std::string& fixtureName,
00058                              const std::string& testName,
00059                              const TestParametersDescriptor& parameters,
00060                              const TestResult& result) = 0;
00061 
00062 
00064 
00070         virtual void SkipDisabledTest(const std::string& fixtureName,
00071                                       const std::string& testName,
00072                                       const TestParametersDescriptor&
00073                                       parameters,
00074                                       const std::size_t& runsCount,
00075                                       const std::size_t& iterationsCount) = 0;
00076 
00077 
00078         virtual ~Outputter()
00079         {
00080 
00081         }
00082     protected:
00084         static void WriteTestNameToStream(std::ostream& stream,
00085                                           const std::string& fixtureName,
00086                                           const std::string& testName,
00087                                           const TestParametersDescriptor&
00088                                           parameters)
00089         {
00090             stream << fixtureName << "." << testName;
00091 
00092             const std::vector<TestParameterDescriptor>& descs =
00093                 parameters.Parameters();
00094 
00095             if (descs.empty())
00096             {
00097                 return;
00098             }
00099 
00100             stream << "(";
00101 
00102             for (std::size_t i = 0; i < descs.size(); ++i)
00103             {
00104                 if (i)
00105                 {
00106                     stream << ", ";
00107                 }
00108 
00109                 const TestParameterDescriptor& desc = descs[i];
00110                 stream << desc.Declaration << " = " << desc.Value;
00111             }
00112 
00113             stream << ")";
00114         }
00115     };
00116 }
00117 #endif


hayai
Author(s): Nick Bruun
autogenerated on Thu Jun 6 2019 18:13:43