Classes | Macros | Typedefs | Enumerations | Functions
output_test.h File Reference
#include <initializer_list>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <functional>
#include <sstream>
#include "../src/re.h"
#include "benchmark/benchmark.h"
Include dependency graph for output_test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Results
 
struct  TestCase
 

Macros

#define _CHECK_FLOAT_RESULT_VALUE(entry, getfn, var_type, var_name, relationship, value, eps_factor)
 
#define _CHECK_RESULT_VALUE(entry, getfn, var_type, var_name, relationship, value)
 
#define ADD_CASES(...)   int CONCAT(dummy, __LINE__) = ::AddCases(__VA_ARGS__)
 
#define CHECK_BENCHMARK_RESULTS(bm_name_pattern, checker_function)   size_t CONCAT(dummy, __LINE__) = AddChecker(bm_name_pattern, checker_function)
 
#define CHECK_COUNTER_VALUE(entry, var_type, var_name, relationship, value)   _CHECK_RESULT_VALUE(entry, GetCounterAs, var_type, var_name, relationship, value)
 
#define CHECK_FLOAT_COUNTER_VALUE(entry, var_name, relationship, value, eps_factor)   _CHECK_FLOAT_RESULT_VALUE(entry, GetCounterAs, double, var_name, relationship, value, eps_factor)
 
#define CHECK_FLOAT_RESULT_VALUE(entry, var_name, relationship, value, eps_factor)   _CHECK_FLOAT_RESULT_VALUE(entry, GetAs, double, var_name, relationship, value, eps_factor)
 
#define CHECK_RESULT_VALUE(entry, var_type, var_name, relationship, value)   _CHECK_RESULT_VALUE(entry, GetAs, var_type, var_name, relationship, value)
 
#define CONCAT(x, y)   CONCAT2(x, y)
 
#define CONCAT2(x, y)   x##y
 
#define SET_SUBSTITUTIONS(...)   int CONCAT(dummy, __LINE__) = ::SetSubstitutions(__VA_ARGS__)
 

Typedefs

typedef std::function< void(Results const &) > ResultsCheckFn
 

Enumerations

enum  MatchRules { MR_Default, MR_Next, MR_Not }
 
enum  TestCaseID {
  TC_ConsoleOut, TC_ConsoleErr, TC_JSONOut, TC_JSONErr,
  TC_CSVOut, TC_CSVErr, TC_NumID
}
 

Functions

int AddCases (TestCaseID ID, std::initializer_list< TestCase > il)
 
size_t AddChecker (const char *bm_name_pattern, ResultsCheckFn fn)
 
void RunOutputTests (int argc, char *argv[])
 
int SetSubstitutions (std::initializer_list< std::pair< std::string, std::string >> il)
 

Macro Definition Documentation

◆ _CHECK_FLOAT_RESULT_VALUE

#define _CHECK_FLOAT_RESULT_VALUE (   entry,
  getfn,
  var_type,
  var_name,
  relationship,
  value,
  eps_factor 
)
Value:
CONCAT(CHECK_FLOAT_, relationship) \
(entry.getfn< var_type >(var_name), (value), (eps_factor) * (value)) << "\n" \
<< __FILE__ << ":" << __LINE__ << ": " << (entry).name << ":\n" \
<< __FILE__ << ":" << __LINE__ << ": " \
<< "expected (" << #var_type << ")" << (var_name) \
<< "=" << (entry).getfn< var_type >(var_name) \
<< " to be " #relationship " to " << (value) << "\n" \
<< __FILE__ << ":" << __LINE__ << ": " \
<< "with tolerance of " << (eps_factor) * (value) \
<< " (" << (eps_factor)*100. << "%), " \
<< "but delta was " << ((entry).getfn< var_type >(var_name) - (value)) \
<< " (" << (((entry).getfn< var_type >(var_name) - (value)) \
/ \
((value) > 1.e-5 || value < -1.e-5 ? value : 1.e-5)*100.) \
<< "%)"

Definition at line 162 of file output_test.h.

◆ _CHECK_RESULT_VALUE

#define _CHECK_RESULT_VALUE (   entry,
  getfn,
  var_type,
  var_name,
  relationship,
  value 
)
Value:
CONCAT(CHECK_, relationship) \
(entry.getfn< var_type >(var_name), (value)) << "\n" \
<< __FILE__ << ":" << __LINE__ << ": " << (entry).name << ":\n" \
<< __FILE__ << ":" << __LINE__ << ": " \
<< "expected (" << #var_type << ")" << (var_name) \
<< "=" << (entry).getfn< var_type >(var_name) \
<< " to be " #relationship " to " << (value) << "\n"

Definition at line 151 of file output_test.h.

◆ ADD_CASES

#define ADD_CASES (   ...)    int CONCAT(dummy, __LINE__) = ::AddCases(__VA_ARGS__)

Definition at line 19 of file output_test.h.

◆ CHECK_BENCHMARK_RESULTS

#define CHECK_BENCHMARK_RESULTS (   bm_name_pattern,
  checker_function 
)    size_t CONCAT(dummy, __LINE__) = AddChecker(bm_name_pattern, checker_function)

Definition at line 75 of file output_test.h.

◆ CHECK_COUNTER_VALUE

#define CHECK_COUNTER_VALUE (   entry,
  var_type,
  var_name,
  relationship,
  value 
)    _CHECK_RESULT_VALUE(entry, GetCounterAs, var_type, var_name, relationship, value)

Definition at line 182 of file output_test.h.

◆ CHECK_FLOAT_COUNTER_VALUE

#define CHECK_FLOAT_COUNTER_VALUE (   entry,
  var_name,
  relationship,
  value,
  eps_factor 
)    _CHECK_FLOAT_RESULT_VALUE(entry, GetCounterAs, double, var_name, relationship, value, eps_factor)

Definition at line 188 of file output_test.h.

◆ CHECK_FLOAT_RESULT_VALUE

#define CHECK_FLOAT_RESULT_VALUE (   entry,
  var_name,
  relationship,
  value,
  eps_factor 
)    _CHECK_FLOAT_RESULT_VALUE(entry, GetAs, double, var_name, relationship, value, eps_factor)

Definition at line 185 of file output_test.h.

◆ CHECK_RESULT_VALUE

#define CHECK_RESULT_VALUE (   entry,
  var_type,
  var_name,
  relationship,
  value 
)    _CHECK_RESULT_VALUE(entry, GetAs, var_type, var_name, relationship, value)

Definition at line 179 of file output_test.h.

◆ CONCAT

#define CONCAT (   x,
  y 
)    CONCAT2(x, y)

Definition at line 17 of file output_test.h.

◆ CONCAT2

#define CONCAT2 (   x,
  y 
)    x##y

Definition at line 16 of file output_test.h.

◆ SET_SUBSTITUTIONS

#define SET_SUBSTITUTIONS (   ...)    int CONCAT(dummy, __LINE__) = ::SetSubstitutions(__VA_ARGS__)

Definition at line 21 of file output_test.h.

Typedef Documentation

◆ ResultsCheckFn

typedef std::function< void(Results const&) > ResultsCheckFn

Definition at line 78 of file output_test.h.

Enumeration Type Documentation

◆ MatchRules

enum MatchRules
Enumerator
MR_Default 
MR_Next 
MR_Not 

Definition at line 24 of file output_test.h.

◆ TestCaseID

enum TestCaseID
Enumerator
TC_ConsoleOut 
TC_ConsoleErr 
TC_JSONOut 
TC_JSONErr 
TC_CSVOut 
TC_CSVErr 
TC_NumID 

Definition at line 40 of file output_test.h.

Function Documentation

◆ AddCases()

int AddCases ( TestCaseID  ID,
std::initializer_list< TestCase il 
)

Definition at line 343 of file output_test_helper.cc.

◆ AddChecker()

size_t AddChecker ( const char *  bm_name_pattern,
ResultsCheckFn  fn 
)

Definition at line 287 of file output_test_helper.cc.

◆ RunOutputTests()

void RunOutputTests ( int  argc,
char *  argv[] 
)

Definition at line 367 of file output_test_helper.cc.

◆ SetSubstitutions()

int SetSubstitutions ( std::initializer_list< std::pair< std::string, std::string >>  il)

Definition at line 349 of file output_test_helper.cc.

CONCAT
#define CONCAT(x, y)
Definition: output_test.h:17
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:03