ZeroErr
|
Namespaces | |
detail | |
details | |
Classes | |
struct | BenchState |
struct | ColorInit |
struct | DataBlock |
class | FileLogger |
struct | FileCache |
class | DirectoryLogger |
class | OStreamLogger |
struct | StyleManager |
struct | Filters |
class | ConsoleReporter |
class | XmlReporter |
struct | assert_info |
This is a one-byte assert info struct, which is used to collect the meta info of an assertion. More... | |
struct | AssertionData |
AssertionData is a struct that contains all the information of an assertion. It will be thrown as an exception when the assertion failed. More... | |
struct | PerfCountSet |
PerfCountSet is a set of performance counters. More... | |
struct | PerformanceCounter |
PerformanceCounter is a class to measure the performance of a function. More... | |
struct | BenchResult |
BenchResult is a result of running the benchmark. More... | |
struct | Benchmark |
Benchmark create a core object for configuration of a benchmark. This class is a driver to run multiple times of a benchmark. Each time of a run will generate a row of data. Report will print the data in console. More... | |
struct | last |
struct | last< T1 > |
class | AggregateOf |
class | Arbitrary |
class | Arbitrary< bool > |
class | Arbitrary< T, is_unsigned_int< T > > |
class | Arbitrary< T, is_signed_int< T > > |
class | Arbitrary< T, is_float_point< T > > |
class | Arbitrary< T, is_string< T > > |
class | Arbitrary< T, is_modifable< T > > |
class | Arbitrary< std::pair< T, U > > |
class | Arbitrary< std::tuple< T... > > |
class | Arbitrary< const T > |
struct | ContainerOfBase |
class | AssociativeContainerOf |
class | SequenceContainerOf |
class | Domain |
Domain class for generating random values of a specific type. More... | |
class | DomainConvertable |
class | ElementOf |
class | InRange |
struct | FuzzTest |
FuzzTest is a template class to create a fuzz test for the target function. More... | |
struct | FuzzTestWithDomain |
FuzzTestWithDomain implements the Base class with the domain passed into. More... | |
struct | IFuzzTest |
class | FuzzFinishedException |
struct | TerminalSize |
struct | deferred_false |
struct | ExprResult |
struct | Expression |
struct | ExpressionDecomposer |
class | IMatcher |
class | IMatcherRef |
class | CombinedMatcher |
class | NotMatcher |
struct | StartWithMatcher |
class | Rng |
struct | IRObject |
struct | LogInfo |
LogInfo is a struct to store the meta data of the log message. More... | |
struct | LogMessage |
LogMessage is a class to store the log message. More... | |
struct | LogMessageImpl |
LogMessageImpl is the implementation of the LogMessage. More... | |
class | Logger |
struct | PushResult |
class | LogIterator |
LogIterator is a class to iterate the log messages. More... | |
class | LogStream |
LogStream is a class to manage the log messages. More... | |
class | IContextScope |
ContextScope is a helper class created in each basic block where you use INFO(). The context scope can has lazy evaluated function F(std::ostream&) that is called when the assertation is failed. More... | |
class | ContextScope |
struct | rank |
rank is a helper class for Printer to define the priority of overloaded functions. More... | |
struct | rank< 0 > |
struct | Printer |
A functor class Printer for printing a value of any type. More... | |
struct | Card |
Card defines a display range in the console. More... | |
class | Table |
Table is used to generate a table with configurable style. More... | |
class | TestContext |
TestContext is a class that holds the test results and reporter context. There are 8 different matrices that are used to store the test results. More... | |
struct | UnitTest |
UnitTest is a class that holds the test configuration. There are several options that can be set to configure the test. More... | |
struct | TestCase |
TestCase is a class that holds the test case information. There are several fields that are used to store the test case information. More... | |
struct | SubCase |
SubCase is a class that holds the subcase information. More... | |
struct | TestedObjects |
class | IReporter |
IReporter is an interface that is used to report the test results. You can create a new reporter by inheriting this class and implementing the virtual functions. The following events will be called once it happens during testing. More... | |
class | CombinationalTest |
CombinationalTest is a class that is used to cross test a few lists of arguments. One example. More... | |
class | TestArgs |
TestArgs is a class that is used to store the test arguments. More... | |
Typedefs | |
using | Clock = std::conditional< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock >::type |
template<typename T > | |
using | is_unsigned_int = typename std::enable_if< std::is_integral< T >::value &&!std::numeric_limits< T >::is_signed, void >::type |
template<typename T > | |
using | is_signed_int = typename std::enable_if< std::is_integral< T >::value &&std::numeric_limits< T >::is_signed, void >::type |
template<typename T > | |
using | is_float_point = typename std::enable_if< std::is_floating_point< T >::value, void >::type |
template<typename T > | |
using | is_string = typename std::enable_if< detail::is_specialization< T, std::basic_string >::value >::type |
template<typename T > | |
using | is_modifable = typename std::enable_if<!detail::is_specialization< T, std::basic_string >::value, decltype(T().begin(), T().end(), T().size(), T().insert(T().end(), std::declval< typename T::value_type >()), T().erase(T().begin()),(void) 0)>::type |
typedef std::string(* | LogCustomCallback) (const LogMessage &, bool colorful) |
Enumerations | |
enum class | assert_level : uint8_t { ZEROERR_WARN_l , ZEROERR_ERROR_l , ZEROERR_FATAL_l } |
enum class | assert_throw : uint8_t { no_throw , throws , throws_as } |
enum class | assert_cmp : uint8_t { eq , ne , gt , ge , lt , le } |
enum | OutputStream { STDOUT , STDERR } |
enum | LogSeverity { INFO_l , LOG_l , WARN_l , ERROR_l , FATAL_l } |
enum | TestType { test_case = 1 , sub_case = 1 << 1 , bench = 1 << 2 , fuzz_test = 1 << 3 } |
TestType is a enum describe the type of the test case. More... | |
Functions | |
Clock::duration | calcClockResolution (size_t numEvaluations) noexcept |
Clock::duration | clockResolution () noexcept |
BenchState * | createBenchState (Benchmark &benchmark) |
void | destroyBenchState (BenchState *state) |
size_t | getNumIter (BenchState *state) |
void | runIteration (BenchState *state) |
void | moveResult (BenchState *state, std::string name) |
ZEROERR_MUTEX (m) | |
void | disableColorOutput () |
Global function to disable colorful output. More... | |
void | enableColorOutput () |
Global function to enable colorful output. More... | |
void | RunFuzzTest (IFuzzTest &fuzz_test, int seed, int runs, int max_len, int timeout, int len_control) |
void | setLogCustomCallback (LogCustomCallback callback) |
set the log custom callback, this can support custom format of the log message More... | |
void | setLogLevel (LogSeverity level) |
set the log level More... | |
void | setLogCategory (const char *categories) |
set the log category More... | |
void | suspendLog () |
suspend the log to flush to the file More... | |
void | resumeLog () |
resume the log to flush to the file More... | |
Printer & | getStdoutPrinter () |
Printer & | getStderrPrinter () |
std::string | _rept (unsigned k, std::string j, Table::Style &) |
template<typename Arg > | |
void | doNotOptimizeAway (Arg &&arg) |
Makes sure none of the given arguments are optimized away by the compiler. More... | |
template<typename... Args> | |
auto | get_last (Args &&... args) -> typename last< Args... >::type |
get_last is a function to get the last argument of a variadic template. It is used by DebugExpr. More... | |
template<typename... T> | |
auto | DebugExpr (const char *file, unsigned line, const char *func, const char *exprs, T... t) -> typename last< T... >::type |
DebugExpr is a function to print any type of variable with its type name. It is used by dbg macro. More... | |
template<typename... Inner> | |
AggregateOf< std::tuple< typename Inner::ValueType... >, Inner... > | TupleOf (Inner &&... inner) |
template<typename K , typename V > | |
AggregateOf< std::pair< typename K::ValueType, typename V::ValueType >, K, V > | PairOf (K &&k, V &&v) |
template<typename T , typename Inner > | |
std::enable_if< detail::is_associative_container< T >::value, AssociativeContainerOf< T, Inner > >::type | ContainerOf (Inner &&inner) |
template<typename T , typename Inner > | |
std::enable_if<!detail::is_associative_container< T >::value &&detail::is_container< T >::value, SequenceContainerOf< T, Inner > >::type | ContainerOf (Inner &&inner) |
template<template< typename, typename... > class T, typename... Inner, typename C = T<typename Inner::ValueType...>> | |
auto | ContainerOf (Inner... inner) -> decltype(ContainerOf< C >(std::move(inner)...)) |
template<typename... T> | |
std::string | format (const char *fmt, T... args) |
Format a string with arguments. More... | |
template<typename T > | |
FuzzTest< T > | FuzzFunction (T func, TestContext *context) |
template<typename T > | |
std::vector< T > | ReadCorpusFromDir (std::string dir) |
bool | isTerminalOutput (OutputStream stream) |
TerminalSize | getTerminalSize () |
template<typename T > | |
std::enable_if< std::is_constructible< std::string, T >::value, IMatcherRef< std::string > >::type | start_with (T &&s) |
template<typename... T> | |
PushResult | log (T &&... args) |
template<typename... T> | |
PushResult | log (LogStream &stream, T &&... args) |
template<typename F > | |
ContextScope< F > | MakeContextScope (const F &f) |
template<typename T > | |
void | PrinterExt (Printer &P, T v, unsigned level, const char *lb, rank< 0 >) |
PrinterExt is an extension of Printer that allows user to write custom rules for printing. More... | |
Variables | |
const char * | Reset = _Reset |
const char * | Bright = _Bright |
const char * | Dim = _Dim |
const char * | Underscore = _Underscore |
const char * | Blink = _Blink |
const char * | Reverse = _Reverse |
const char * | Hidden = _Hidden |
const char * | FgBlack = _FgBlack |
const char * | FgRed = _FgRed |
const char * | FgGreen = _FgGreen |
const char * | FgYellow = _FgYellow |
const char * | FgBlue = _FgBlue |
const char * | FgMagenta = _FgMagenta |
const char * | FgCyan = _FgCyan |
const char * | FgWhite = _FgWhite |
const char * | BgBlack = _BgBlack |
const char * | BgRed = _BgRed |
const char * | BgGreen = _BgGreen |
const char * | BgYellow = _BgYellow |
const char * | BgBlue = _BgBlue |
const char * | BgMagenta = _BgMagenta |
const char * | BgCyan = _BgCyan |
const char * | BgWhite = _BgWhite |
int | _ZEROERR_G_VERBOSE = 0 |
thread_local std::vector< IContextScope * > | _ZEROERR_G_CONTEXT_SCOPE_VECTOR |
constexpr size_t | LogStreamMaxSize = 1 * 1024 - 16 |
constexpr unsigned | max_rank = 5 |
using zeroerr::Clock = typedef std::conditional<std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock>::type |
using zeroerr::is_float_point = typedef typename std::enable_if<std::is_floating_point<T>::value, void>::type |
using zeroerr::is_modifable = typedef typename std::enable_if<!detail::is_specialization<T, std::basic_string>::value, decltype( T().begin(), T().end(), T().size(), T().insert(T().end(), std::declval<typename T::value_type>()), T().erase(T().begin()), (void)0)>::type |
using zeroerr::is_signed_int = typedef typename std::enable_if<std::is_integral<T>::value && std::numeric_limits<T>::is_signed, void>::type |
using zeroerr::is_string = typedef typename std::enable_if<detail::is_specialization<T, std::basic_string>::value>::type |
using zeroerr::is_unsigned_int = typedef typename std::enable_if<std::is_integral<T>::value && !std::numeric_limits<T>::is_signed, void>::type |
typedef std::string(* zeroerr::LogCustomCallback) (const LogMessage &, bool colorful) |
|
strong |
|
strong |
|
strong |
enum zeroerr::LogSeverity |
enum zeroerr::TestType |
|
inline |
|
noexcept |
|
noexcept |
std::enable_if<detail::is_associative_container<T>::value, AssociativeContainerOf<T, Inner> >::type zeroerr::ContainerOf | ( | Inner && | inner | ) |
std::enable_if<!detail::is_associative_container<T>::value && detail::is_container<T>::value, SequenceContainerOf<T, Inner> >::type zeroerr::ContainerOf | ( | Inner && | inner | ) |
auto zeroerr::ContainerOf | ( | Inner... | inner | ) | -> decltype(ContainerOf<C>(std::move(inner)...)) |
BenchState * zeroerr::createBenchState | ( | Benchmark & | benchmark | ) |
auto zeroerr::DebugExpr | ( | const char * | file, |
unsigned | line, | ||
const char * | func, | ||
const char * | exprs, | ||
T... | t | ||
) | -> typename last<T...>::type |
DebugExpr is a function to print any type of variable with its type name. It is used by dbg macro.
void zeroerr::destroyBenchState | ( | BenchState * | state | ) |
void zeroerr::disableColorOutput | ( | ) |
Global function to disable colorful output.
void zeroerr::doNotOptimizeAway | ( | Arg && | arg | ) |
Makes sure none of the given arguments are optimized away by the compiler.
Arg | Type of the argument that shouldn't be optimized away. |
arg | The input that we mark as being used, even though we don't do anything with it. |
void zeroerr::enableColorOutput | ( | ) |
Global function to enable colorful output.
std::string zeroerr::format | ( | const char * | fmt, |
T... | args | ||
) |
Format a string with arguments.
fmt | The format string |
args | The arguments |
This function is used to format a string with arguments. The format string is a string with placeholders in the form of {}
. You can pass any type of arguments to this function and it will format the string accordingly.
Example: format("Hello, {name}!", "John") -> "Hello, John!"
FuzzTest<T> zeroerr::FuzzFunction | ( | T | func, |
TestContext * | context | ||
) |
auto zeroerr::get_last | ( | Args &&... | args | ) | -> typename last<Args...>::type |
get_last is a function to get the last argument of a variadic template. It is used by DebugExpr.
size_t zeroerr::getNumIter | ( | BenchState * | state | ) |
Printer & zeroerr::getStderrPrinter | ( | ) |
Printer & zeroerr::getStdoutPrinter | ( | ) |
TerminalSize zeroerr::getTerminalSize | ( | ) |
bool zeroerr::isTerminalOutput | ( | OutputStream | stream | ) |
PushResult zeroerr::log | ( | LogStream & | stream, |
T &&... | args | ||
) |
PushResult zeroerr::log | ( | T &&... | args | ) |
ContextScope<F> zeroerr::MakeContextScope | ( | const F & | f | ) |
void zeroerr::moveResult | ( | BenchState * | state, |
std::string | name | ||
) |
AggregateOf<std::pair<typename K::ValueType, typename V::ValueType>, K, V> zeroerr::PairOf | ( | K && | k, |
V && | v | ||
) |
void zeroerr::PrinterExt | ( | Printer & | P, |
T | v, | ||
unsigned | level, | ||
const char * | lb, | ||
rank< 0 > | |||
) |
PrinterExt is an extension of Printer that allows user to write custom rules for printing.
User can use SFINAE to extend PrinterExt, e.g.:
T | the type of the object to be printed. |
P | Printer class |
v | the object to be printed. |
level | the indentation level. |
lb | the line break. |
r | the rank of the rule. 0 is lowest priority. |
std::vector<T> zeroerr::ReadCorpusFromDir | ( | std::string | dir | ) |
void zeroerr::resumeLog | ( | ) |
resume the log to flush to the file
void zeroerr::RunFuzzTest | ( | IFuzzTest & | fuzz_test, |
int | seed, | ||
int | runs, | ||
int | max_len, | ||
int | timeout, | ||
int | len_control | ||
) |
void zeroerr::runIteration | ( | BenchState * | state | ) |
void zeroerr::setLogCategory | ( | const char * | categories | ) |
set the log category
void zeroerr::setLogCustomCallback | ( | LogCustomCallback | callback | ) |
set the log custom callback, this can support custom format of the log message
void zeroerr::setLogLevel | ( | LogSeverity | level | ) |
set the log level
std::enable_if<std::is_constructible<std::string, T>::value, IMatcherRef<std::string> >::type zeroerr::start_with | ( | T && | s | ) |
void zeroerr::suspendLog | ( | ) |
suspend the log to flush to the file
AggregateOf<std::tuple<typename Inner::ValueType...>, Inner...> zeroerr::TupleOf | ( | Inner &&... | inner | ) |
zeroerr::ZEROERR_MUTEX | ( | m | ) |
thread_local std::vector< IContextScope * > zeroerr::_ZEROERR_G_CONTEXT_SCOPE_VECTOR |
int zeroerr::_ZEROERR_G_VERBOSE = 0 |
const char * zeroerr::BgBlack = _BgBlack |
const char * zeroerr::BgBlue = _BgBlue |
const char * zeroerr::BgCyan = _BgCyan |
const char * zeroerr::BgGreen = _BgGreen |
const char * zeroerr::BgMagenta = _BgMagenta |
const char * zeroerr::BgRed = _BgRed |
const char * zeroerr::BgWhite = _BgWhite |
const char * zeroerr::BgYellow = _BgYellow |
const char * zeroerr::Blink = _Blink |
const char * zeroerr::Bright = _Bright |
const char * zeroerr::Dim = _Dim |
const char * zeroerr::FgBlack = _FgBlack |
const char * zeroerr::FgBlue = _FgBlue |
const char * zeroerr::FgCyan = _FgCyan |
const char * zeroerr::FgGreen = _FgGreen |
const char * zeroerr::FgMagenta = _FgMagenta |
const char * zeroerr::FgRed = _FgRed |
const char * zeroerr::FgWhite = _FgWhite |
const char * zeroerr::FgYellow = _FgYellow |
const char * zeroerr::Hidden = _Hidden |
|
constexpr |
|
constexpr |
const char * zeroerr::Reset = _Reset |
const char * zeroerr::Reverse = _Reverse |
const char * zeroerr::Underscore = _Underscore |