mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
* inja2 * header only * reduce dependencies * code cleaning * c++17 * use stdc++ * code cleaning * infrastructure * header only * add infrastructure * fix tests * use minimum clang 6 * code cleaning, polyfill for c++11 * fix some file tests * fix readme * update appveyor * fix polyfill and ci * fix polyfill * fix ci? * test msvc __cplusplus * add doxygen * activate all tests * code cleaning * add coveralls, set default to dot notation * add html test * add doxygen comments * test single_include file * change build folder in appveyor * correct make arguments in appveyor * fix appveyor arguments
114 lines
3.8 KiB
C++
Executable File
114 lines
3.8 KiB
C++
Executable File
#ifndef __HAYAI_OUTPUTTER
|
|
#define __HAYAI_OUTPUTTER
|
|
#include <iostream>
|
|
#include <cstddef>
|
|
|
|
#include "hayai_test_result.hpp"
|
|
|
|
|
|
namespace hayai
|
|
{
|
|
/// Outputter.
|
|
|
|
/// Abstract base class for outputters.
|
|
class Outputter
|
|
{
|
|
public:
|
|
/// Begin benchmarking.
|
|
|
|
/// The total number of benchmarks registred is the sum of the two
|
|
/// counts passed to the outputter.
|
|
///
|
|
/// @param enabledCount Number of benchmarks to be executed.
|
|
/// @param disabledCount Number of disabled benchmarks to be skipped.
|
|
virtual void Begin(const std::size_t& enabledCount,
|
|
const std::size_t& disabledCount) = 0;
|
|
|
|
|
|
/// End benchmarking.
|
|
|
|
/// @param executedCount Number of benchmarks that have been executed.
|
|
/// @param disabledCount Number of benchmarks that have been skipped
|
|
/// because they are disabled.
|
|
virtual void End(const std::size_t& executedCount,
|
|
const std::size_t& disabledCount) = 0;
|
|
|
|
|
|
/// Begin benchmark test run.
|
|
|
|
/// @param fixtureName Fixture name.
|
|
/// @param testName Test name.
|
|
/// @param parameters Test parameter description.
|
|
/// @param runsCount Number of runs to be executed.
|
|
/// @param iterationsCount Number of iterations per run.
|
|
virtual void BeginTest(const std::string& fixtureName,
|
|
const std::string& testName,
|
|
const TestParametersDescriptor& parameters,
|
|
const std::size_t& runsCount,
|
|
const std::size_t& iterationsCount) = 0;
|
|
|
|
|
|
/// End benchmark test run.
|
|
|
|
/// @param fixtureName Fixture name.
|
|
/// @param testName Test name.
|
|
/// @param parameters Test parameter description.
|
|
/// @param result Test result.
|
|
virtual void EndTest(const std::string& fixtureName,
|
|
const std::string& testName,
|
|
const TestParametersDescriptor& parameters,
|
|
const TestResult& result) = 0;
|
|
|
|
|
|
/// Skip disabled benchmark test run.
|
|
|
|
/// @param fixtureName Fixture name.
|
|
/// @param testName Test name.
|
|
/// @param parameters Test parameter description.
|
|
/// @param runsCount Number of runs to be executed.
|
|
/// @param iterationsCount Number of iterations per run.
|
|
virtual void SkipDisabledTest(const std::string& fixtureName,
|
|
const std::string& testName,
|
|
const TestParametersDescriptor&
|
|
parameters,
|
|
const std::size_t& runsCount,
|
|
const std::size_t& iterationsCount) = 0;
|
|
|
|
|
|
virtual ~Outputter()
|
|
{
|
|
|
|
}
|
|
protected:
|
|
/// Write a nicely formatted test name to a stream.
|
|
static void WriteTestNameToStream(std::ostream& stream,
|
|
const std::string& fixtureName,
|
|
const std::string& testName,
|
|
const TestParametersDescriptor&
|
|
parameters)
|
|
{
|
|
stream << fixtureName << "." << testName;
|
|
|
|
const std::vector<TestParameterDescriptor>& descs =
|
|
parameters.Parameters();
|
|
|
|
if (descs.empty())
|
|
return;
|
|
|
|
stream << "(";
|
|
|
|
for (std::size_t i = 0; i < descs.size(); ++i)
|
|
{
|
|
if (i)
|
|
stream << ", ";
|
|
|
|
const TestParameterDescriptor& desc = descs[i];
|
|
stream << desc.Declaration << " = " << desc.Value;
|
|
}
|
|
|
|
stream << ")";
|
|
}
|
|
};
|
|
}
|
|
#endif
|