JayBeams  0.1
Another project to have fun coding.
Namespaces | Classes | Typedefs | Functions | Variables
jb::testing Namespace Reference

Helper functions and classes to simplify unit tests. More...

Namespaces

 defaults
 Define the default values for a microbenchmark config.
 
 detail
 

Classes

struct  create_random_sample
 Wrap a random number generator so it can be used for both real and complex numbers. More...
 
struct  create_random_sample< std::complex< T > >
 Specialize create_random_sample for complex numbers. More...
 
struct  extrapolate_periodic
 A functor to extrapolate a periodic timseries. More...
 
struct  extrapolate_with_zeroes
 A functor to extrapolate with zeroes. More...
 
class  has_resize
 Type trait to evaluate if a collection of numbers (e.g. More...
 
class  microbenchmark
 Run a micro-benchmark on a given class. More...
 
class  microbenchmark_base
 Refactor non-template parts of the microbenchmark template class. More...
 
class  microbenchmark_config
 Configure a micro-benchmark. More...
 

Typedefs

template<typename config >
using microbenchmark_group = std::map< std::string, std::function< void(config const &cfg)> >
 Define a representation for a group of microbenchmarks. More...
 

Functions

template<typename value_t , typename std::enable_if< std::is_integral< value_t >::value >::type * = nullptr>
bool check_close_enough (value_t num_a, value_t num_b, int tol)
 Given two numbers of the same integer type check if the difference is within a given tolerance. More...
 
template<typename value_t >
bool check_close_enough (std::complex< value_t > com_a, std::complex< value_t > com_b, int tol=1)
 Given two complex numbers of the same value type check if the difference is within a given tolerance. More...
 
template<typename value_t >
bool check_close_enough (value_t com_a[2], value_t com_b[2], int tol=1)
 Compare complex number (as arrays of size 2) values with some tolerance. More...
 
template<typename floating >
void check_small (floating t, double small)
 Verify that a floating point value is "close enough" to a small number. More...
 
template<typename real >
void check_small (std::complex< real > t, double small)
 Verify that a complex number is "close enough" to a small number. More...
 
template<typename precision_t >
std::complex< precision_t > format (precision_t v[2])
 Wrap FFTW-style complex numbers in std::complex for iostreaming. More...
 
template<typename value_type >
value_type format (value_type t)
 Allow generic treatment of FFTW-style complex numbers and other types. More...
 
template<typename real , typename std::enable_if< std::is_floating_point< real >::value >::type * = nullptr>
real relative_error (real actual, real expected)
 Calculate the relative error between two float point numbers. More...
 
template<typename integral , typename std::enable_if< std::is_integral< integral >::value >::type * = nullptr>
integral relative_error (integral actual, integral expected)
 Adapt relative_error() for integral numbers. More...
 
template<typename real >
real relative_error (std::complex< real > actual, std::complex< real > expected)
 Calculate the relative error between two complex numbers. More...
 
template<typename real >
real relative_error (real actual[2], real expected[2])
 Calculate the relative error between two complex numbers in FFTW representation. More...
 
template<typename collection_t >
bool check_collection_close_enough (collection_t const &a, collection_t const &b, int tol=1, int max_differences_printed=JB_TESTING_MAX_DIFFERENCES_PRINTED)
 Given two collections of numbers of the same value type, find the differences that are out of a given tolerance and report them via Boost.Test functions. More...
 
template<typename T , std::size_t K>
bool check_collection_close_enough (boost::multi_array< T, K > const &a, boost::multi_array< T, K > const &b, int tol=1, int max_differences_printed=JB_TESTING_MAX_DIFFERENCES_PRINTED)
 Specialization for boost::multi_array type. More...
 
template<typename value_t >
bool check_collection_close_enough (std::size_t size, value_t const *a, value_t const *b, int tol=1, int max_differences_printed=JB_TESTING_MAX_DIFFERENCES_PRINTED)
 Given two collections of integers, floating point or complex numbers find the differences that are out of a given tolerance and report them via Boost.Test functions. More...
 
template<typename timeseries , typename generator >
void create_random_timeseries (generator &gen, int nsamples, timeseries &ts)
 Create a simple timeseries where the values look like a random. More...
 
template<typename timeseries >
void create_square_timeseries (int nsamples, timeseries &ts)
 Create a simple timeseries where the values look like a square. More...
 
template<typename timeseries >
void create_triangle_timeseries (int nsamples, timeseries &ts)
 Create a simple timeseries where the values look like a triangle. More...
 
template<typename T , std::size_t K, typename A >
void create_triangle_timeseries (int nsamples, boost::multi_array< T, K, A > &ts)
 Create a family of timeseries where the values look like parallel triangles shifted by a constant value. More...
 
template<typename timeseries_t , typename duration_t , typename extrapolation_functor >
jb::detail::array_traits< timeseries_t >::element_type extrapolate_timeseries (timeseries_t const &ts, duration_t t, duration_t sampling_period, extrapolation_functor const &extrapolation)
 A function to get the extrapolated value of a timeseries. More...
 
template<typename timeseries_t , typename duration_t , typename extrapolation_functor >
timeseries_t delay_timeseries (timeseries_t const &ts, duration_t delay, duration_t sampling_period, extrapolation_functor const &extrapolation)
 Delay a timeseries using a user-provided extrapolation policy. More...
 
template<typename timeseries_t , typename duration_t >
timeseries_t delay_timeseries_periodic (timeseries_t const &ts, duration_t delay, duration_t sampling_period)
 Delay a timeseries using a periodic extension for early values. More...
 
template<typename timeseries_t , typename duration_t >
timeseries_t delay_timeseries_zeroes (timeseries_t const &ts, duration_t delay, duration_t sampling_period)
 Delay a timeseries using zeroes for early values. More...
 
template<typename Generator >
Generator initialize_mersenne_twister (int seed, std::string const &token)
 Initialize a Mersenne-Twister based generator. More...
 
std::ostream & operator<< (std::ostream &os, microbenchmark_base::summary const &x)
 Stream the summary of a microbenchmark results in microseconds. More...
 
int microbenchmark_group_main (int argc, char *argv[], microbenchmark_group< microbenchmark_config > const &testcases)
 Overload microbenchmark_group_main for jb::testing::microbenchmark_config. More...
 
template<typename config >
int microbenchmark_group_main (int argc, char *argv[], microbenchmark_group< config > const &testcases)
 Implement the main() function for a multi-testcase benchmark. More...
 
template<typename timeseries >
void resize_if_applicable (timeseries &ts, std::size_t newsize, std::true_type)
 Resize a timeseries to a newsize. More...
 
template<typename timeseries >
void resize_if_applicable (timeseries &ts, std::size_t newsize, std::false_type)
 Dummy specialization for non-resizable timeseries collections. More...
 
template<typename timeseries >
void resize_if_applicable (timeseries &ts, std::size_t newsize)
 Resize a timeseries to a newsize if it is resizable. More...
 
template<typename container_t >
auto sum_square (container_t const &ts)
 Compute the sum square of a family of timeseries. More...
 

Variables

char const uname_a []
 The kernel version, release, machine hardware, etc. More...
 
char const compiler []
 The compiler version. More...
 
char const compiler_flags []
 The compiler flags. More...
 
char const linker []
 The linker version. More...
 
char const gitrev []
 The git revision at compile time. More...
 
char const default_initialization_marker [] = "__default__"
 

Detailed Description

Helper functions and classes to simplify unit tests.

Typedef Documentation

◆ microbenchmark_group

template<typename config >
using jb::testing::microbenchmark_group = typedef std::map<std::string, std::function<void(config const& cfg)> >

Define a representation for a group of microbenchmarks.

Each microbenchmark is encapsulated in a (type erased) std::function, which typically creates an instance of jb::testing::microbenchmark and runs it. The keys into the group are the names of the testcases.

Template Parameters
configthe configuration class for the group of microbenchmarks.

Definition at line 33 of file microbenchmark_group_main.hpp.

Function Documentation

◆ check_close_enough() [1/3]

template<typename value_t , typename std::enable_if< std::is_integral< value_t >::value >::type * = nullptr>
bool jb::testing::check_close_enough ( value_t  num_a,
value_t  num_b,
int  tol 
)

Given two numbers of the same integer type check if the difference is within a given tolerance.

Given two numbers of the same floating-point type check if the difference is within a given tolerance.

Tolerance is expressed as the difference between any pair of integer numbers.

Returns
true if the numbers are within tolerance.
Parameters
num_athe first number to compare
num_bthe second number to compare
toltolerance that the pair of numbers have to be within
Template Parameters
value_tthe type of the integral argument numbers

Tolerance is expressed in "number of epsilons" (i.e., the function will tolerate errors up to tolerance * std::numeric_limit<real>::epsilon()

Returns
true if the numbers are within tolerance.
Parameters
num_athe first number to compare
num_bthe second number to compare
toltolerance that the pair of numbers have to be within
Template Parameters
value_tthe type of the floating-point argument numbers

Definition at line 34 of file check_close_enough.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), check_close_enough(), and check_collection_close_enough().

◆ check_close_enough() [2/3]

template<typename value_t >
bool jb::testing::check_close_enough ( std::complex< value_t >  com_a,
std::complex< value_t >  com_b,
int  tol = 1 
)

Given two complex numbers of the same value type check if the difference is within a given tolerance.

If value types are floating-point numbers, tolerance is expressed in "number of epsilons" (i.e., the function will tolerate errors up to tolerance * std::numeric_limit<real>::epsilon()

If value types are integer numbers, tolerance is expressed as the difference between any pair of integer numbers.

Returns
true if the both the real and imaginary parts are within tolerance
Parameters
com_athe first complex number to compare
com_bthe second complex number to compare
toltolerance that the pair of numbers have to be within
Template Parameters
value_typethe type of std::complex number

Definition at line 95 of file check_close_enough.hpp.

References check_close_enough().

◆ check_close_enough() [3/3]

template<typename value_t >
bool jb::testing::check_close_enough ( value_t  com_a[2],
value_t  com_b[2],
int  tol = 1 
)

Compare complex number (as arrays of size 2) values with some tolerance.

Returns
true if the both the real and imaginary parts are within tolerance.
Parameters
com_athe first complex number to compare
com_bthe second complex number to compare
toltolerance that the pair of numbers have to be within
Template Parameters
value_typethe type of std::complex number

Definition at line 115 of file check_close_enough.hpp.

References check_close_enough().

◆ check_collection_close_enough() [1/3]

template<typename collection_t >
bool jb::testing::check_collection_close_enough ( collection_t const &  a,
collection_t const &  b,
int  tol = 1,
int  max_differences_printed = JB_TESTING_MAX_DIFFERENCES_PRINTED 
)

Given two collections of numbers of the same value type, find the differences that are out of a given tolerance and report them via Boost.Test functions.

Collections of numbers are any container representation (e.g. vector, deque), boost::multi_array, c-like array, etc.

Value types are integers, floating-point, and std::complex (integers or floating-point).

If value types are floating-point numbers, tolerance is expressed in "number of epsilons" (i.e., the function will tolerate errors up to tolerance * std::numeric_limit<real>::epsilon()

If value types are integer numbers, tolerance is expressed as the difference between any pair of integer numbers.

Returns
true if the numbers are within tolerance.
Parameters
athe first collection of numbers to compare
bthe second collection of numbers to compare
toltolerance that each pair of numbers have to be within
max_differences_printedhow many differences will be printed out in full detail, some of the collections are large and printing all the differences can be overwhelming
Template Parameters
collection_tthe type of the collection containing the numbers (e.g. std::vector<>, boost::multi_array)

Definition at line 259 of file check_close_enough.hpp.

References check_close_enough(), jb::error, format(), and relative_error().

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES().

◆ check_collection_close_enough() [2/3]

template<typename T , std::size_t K>
bool jb::testing::check_collection_close_enough ( boost::multi_array< T, K > const &  a,
boost::multi_array< T, K > const &  b,
int  tol = 1,
int  max_differences_printed = JB_TESTING_MAX_DIFFERENCES_PRINTED 
)

Specialization for boost::multi_array type.

Returns
true if the numbers are within tolerance.
Parameters
athe first multi array of numbers to compare
bthe second multi array of numbers to compare
toltolerance that each pair of numbers have to be within
max_differences_printedhow many differences will be printed out in full detail, some of the collections are large and printing all the differences can be overwhelming
Template Parameters
Ttype of the value stored on the timeseries
Ktimeseries dimensionality
Aan Allocator type for type T allocator storage

Definition at line 299 of file check_close_enough.hpp.

References check_close_enough(), jb::error, format(), and relative_error().

◆ check_collection_close_enough() [3/3]

template<typename value_t >
bool jb::testing::check_collection_close_enough ( std::size_t  size,
value_t const *  a,
value_t const *  b,
int  tol = 1,
int  max_differences_printed = JB_TESTING_MAX_DIFFERENCES_PRINTED 
)

Given two collections of integers, floating point or complex numbers find the differences that are out of a given tolerance and report them via Boost.Test functions.

Returns
true if the numbers are within tolerance.
Parameters
sizethe size of collection
athe first multi array of numbers to compare
bthe second multi array of numbers to compare
toltolerance that each pair of numbers have to be within
max_differences_printedhow many differences will be printed out in full detail, some of the collections are large and printing all the differences can be overwhelming
Template Parameters
value_tvalue type of the number stored on collections

Definition at line 342 of file check_close_enough.hpp.

References check_close_enough(), jb::error, format(), relative_error(), and jb::testing::defaults::size.

◆ check_small() [1/2]

template<typename floating >
void jb::testing::check_small ( floating  t,
double  small 
)

Verify that a floating point value is "close enough" to a small number.

Definition at line 125 of file check_close_enough.hpp.

◆ check_small() [2/2]

template<typename real >
void jb::testing::check_small ( std::complex< real >  t,
double  small 
)

Verify that a complex number is "close enough" to a small number.

Definition at line 133 of file check_close_enough.hpp.

◆ create_random_timeseries()

template<typename timeseries , typename generator >
void jb::testing::create_random_timeseries ( generator &  gen,
int  nsamples,
timeseries &  ts 
)

Create a simple timeseries where the values look like a random.

Definition at line 13 of file create_random_timeseries.hpp.

References jb::detail::nsamples().

Referenced by BOOST_AUTO_TEST_CASE().

◆ create_square_timeseries()

template<typename timeseries >
void jb::testing::create_square_timeseries ( int  nsamples,
timeseries &  ts 
)

Create a simple timeseries where the values look like a square.

Definition at line 13 of file create_square_timeseries.hpp.

References jb::detail::nsamples(), and resize_if_applicable().

Referenced by BOOST_AUTO_TEST_CASE(), and main().

◆ create_triangle_timeseries() [1/2]

template<typename timeseries >
void jb::testing::create_triangle_timeseries ( int  nsamples,
timeseries &  ts 
)

Create a simple timeseries where the values look like a triangle.

Definition at line 16 of file create_triangle_timeseries.hpp.

References resize_if_applicable().

Referenced by BOOST_AUTO_TEST_CASE(), and main().

◆ create_triangle_timeseries() [2/2]

template<typename T , std::size_t K, typename A >
void jb::testing::create_triangle_timeseries ( int  nsamples,
boost::multi_array< T, K, A > &  ts 
)

Create a family of timeseries where the values look like parallel triangles shifted by a constant value.

Parameters
nsamplessamples on each timeseries
tsmulti array containing timeseries to be filled as triangle
Template Parameters
Ttype of the timeseries field
Ktimeseries dimensionality
Aan Allocator type for type T allocator storage

The values stored in the input timeseries

Definition at line 38 of file create_triangle_timeseries.hpp.

References jb::detail::element_count(), and jb::detail::nsamples().

◆ delay_timeseries()

template<typename timeseries_t , typename duration_t , typename extrapolation_functor >
timeseries_t jb::testing::delay_timeseries ( timeseries_t const &  ts,
duration_t  delay,
duration_t  sampling_period,
extrapolation_functor const &  extrapolation 
)

Delay a timeseries using a user-provided extrapolation policy.

The values stored in the input timeseries ts

Definition at line 78 of file delay_timeseries.hpp.

References jb::detail::array_shape(), jb::detail::element_count(), and extrapolate_timeseries().

Referenced by delay_timeseries_periodic(), and delay_timeseries_zeroes().

◆ delay_timeseries_periodic()

template<typename timeseries_t , typename duration_t >
timeseries_t jb::testing::delay_timeseries_periodic ( timeseries_t const &  ts,
duration_t  delay,
duration_t  sampling_period 
)

Delay a timeseries using a periodic extension for early values.

The values stored in the input timeseries ts

Definition at line 99 of file delay_timeseries.hpp.

References delay_timeseries().

Referenced by BOOST_AUTO_TEST_CASE(), and main().

◆ delay_timeseries_zeroes()

template<typename timeseries_t , typename duration_t >
timeseries_t jb::testing::delay_timeseries_zeroes ( timeseries_t const &  ts,
duration_t  delay,
duration_t  sampling_period 
)

Delay a timeseries using zeroes for early values.

The values stored in the input timeseries ts

Definition at line 112 of file delay_timeseries.hpp.

References delay_timeseries().

Referenced by BOOST_AUTO_TEST_CASE().

◆ extrapolate_timeseries()

template<typename timeseries_t , typename duration_t , typename extrapolation_functor >
jb::detail::array_traits<timeseries_t>::element_type jb::testing::extrapolate_timeseries ( timeseries_t const &  ts,
duration_t  t,
duration_t  sampling_period,
extrapolation_functor const &  extrapolation 
)

A function to get the extrapolated value of a timeseries.

Parameters
tsa timeseries, typically a std::vector-like data structure
tthe timestamp at which we want to extrapolate the timeseries
sampling_periodthe sampling period of the timeseries
extrapolationimplement the extrapolation
Template Parameters
timeseries_tthe type of the timeseries
duration_tthe type used to represent timestamps, typically a std::chrono::duration<> instantiation
extrapolation_functorthe type of the extrapolation

Definition at line 62 of file delay_timeseries.hpp.

References jb::detail::element_count().

Referenced by delay_timeseries().

◆ format() [1/2]

template<typename precision_t >
std::complex<precision_t> jb::testing::format ( precision_t  v[2])

Wrap FFTW-style complex numbers in std::complex for iostreaming.

Definition at line 140 of file check_close_enough.hpp.

Referenced by check_collection_close_enough().

◆ format() [2/2]

template<typename value_type >
value_type jb::testing::format ( value_type  t)

Allow generic treatment of FFTW-style complex numbers and other types.

Definition at line 146 of file check_close_enough.hpp.

◆ initialize_mersenne_twister()

template<typename Generator >
Generator jb::testing::initialize_mersenne_twister ( int  seed,
std::string const &  token 
)

Initialize a Mersenne-Twister based generator.

Often tests need to initialize a PRNG based on either a command-line argument (to make tests reproduceable), or from the std::random_device (to have good distribution properties in the PRGN). This is a fairly tedious initialization, so we have refactored it to a common function.

Parameters
seedthe command-line argument seed, 0 means initialize from std::random_device.
tokenthe parameter to initialize std::random_device, if default then the random device is default initialized. The semantics of token are platform specific, but on Linux it is usually the device to read random numbers from (/dev/urandom or /dev/random). It is very rare to need /dev/random, specially in tests, where this function is most commonly used.
Returns
a Generator initialized as described above.
Exceptions
std::exceptionif the token is invalid on the platform.
Template Parameters
Generatoran instantiation of std::mersenne_twister_generator<>, most likely std::mt19937 or std::mt19937_64.

Definition at line 38 of file initialize_mersenne_twister.hpp.

◆ microbenchmark_group_main() [1/2]

int jb::testing::microbenchmark_group_main ( int  argc,
char *  argv[],
microbenchmark_group< microbenchmark_config > const &  testcases 
)

Overload microbenchmark_group_main for jb::testing::microbenchmark_config.

A common idiom in complex benchmarks is to create multiple testcases that exercise different implementations, different template instantiations, or otherwise vary the test in a non-trivial way.

In such cases the main() function follows a well understood pattern:

  • Initialize the benchmark configuration.
  • Find which testcase is requested.
  • Call a function for that testcase.
Returns
the exit status for the program
Parameters
argcthe number of arguments in argv
argvthe command-line arguments
testcasesa group of microbenchmarks, executes the one selected via the –microbenchmark.test-case command-line argument.
Exceptions
nothing,allexceptions are captured and printed to stderr before the program exits.

Definition at line 6 of file microbenchmark_group_main.cpp.

References jb::info, JB_LOG, jb::config_object::process_cmdline(), jb::testing::detail::report_exception_at_exit(), jb::testing::microbenchmark_config::test_case, and jb::testing::microbenchmark_config::verbose.

Referenced by main(), and microbenchmark_group_main().

◆ microbenchmark_group_main() [2/2]

template<typename config >
int jb::testing::microbenchmark_group_main ( int  argc,
char *  argv[],
microbenchmark_group< config > const &  testcases 
)

Implement the main() function for a multi-testcase benchmark.

A common idiom in complex benchmarks is to create multiple testcases that exercise different implementations, different template instantiations, or otherwise vary the test in a non-trivial way.

In such cases the main() function follows a well understood pattern:

  • Initialize the benchmark configuration.
  • Find which testcase is requested.
  • Call a function for that testcase.

This class refactors that pattern into a static function.

Template Parameters
configthe configuration object used by the benchmark. We expect that it has at least two configuration attributes:
Returns
the exit status for the program
Parameters
argcthe number of arguments in argv
argvthe command-line arguments
testcasesa group of microbenchmarks, executes the one selected via the –microbenchmark.test-case command-line argument.
Exceptions
nothing,allexceptions are captured and printed to stderr before the program exits.

Definition at line 66 of file microbenchmark_group_main.hpp.

References jb::info, jb::log::init(), JB_LOG, microbenchmark_group_main(), and jb::testing::detail::report_exception_at_exit().

◆ operator<<()

std::ostream & jb::testing::operator<< ( std::ostream &  os,
microbenchmark_base::summary const &  x 
)

◆ relative_error() [1/4]

template<typename real , typename std::enable_if< std::is_floating_point< real >::value >::type * = nullptr>
real jb::testing::relative_error ( real  actual,
real  expected 
)

Calculate the relative error between two float point numbers.

Returns
the relative error of actual compared to offset.
Parameters
actualthe number the test got
expectedthe number the test expected
Template Parameters
realthe type of floating point number (float, double, long double)

Definition at line 163 of file check_close_enough.hpp.

Referenced by check_collection_close_enough(), and relative_error().

◆ relative_error() [2/4]

template<typename integral , typename std::enable_if< std::is_integral< integral >::value >::type * = nullptr>
integral jb::testing::relative_error ( integral  actual,
integral  expected 
)

Adapt relative_error() for integral numbers.

Returns
the absolute difference.
Parameters
actualthe number the test got
expectedthe number the test expected
Template Parameters
integralthe type of integral number

Definition at line 186 of file check_close_enough.hpp.

◆ relative_error() [3/4]

template<typename real >
real jb::testing::relative_error ( std::complex< real >  actual,
std::complex< real >  expected 
)

Calculate the relative error between two complex numbers.

Returns
the relative error of actual compared to offset, using the Manhattan metric.
Parameters
actualthe number the test got
expectedthe number the test expected
Template Parameters
realthe type of floating point number (float, double, long double)

Definition at line 205 of file check_close_enough.hpp.

References relative_error().

◆ relative_error() [4/4]

template<typename real >
real jb::testing::relative_error ( real  actual[2],
real  expected[2] 
)

Calculate the relative error between two complex numbers in FFTW representation.

Returns
the relative error of actual compared to offset, using the Manhattan metric.
Parameters
actualthe number the test got
expectedthe number the test expected
Template Parameters
realthe type of floating point number (float, double, long double)

Definition at line 224 of file check_close_enough.hpp.

References relative_error().

◆ resize_if_applicable() [1/3]

template<typename timeseries >
void jb::testing::resize_if_applicable ( timeseries &  ts,
std::size_t  newsize,
std::true_type   
)

Resize a timeseries to a newsize.

Parameters
tstimeseries are any container representation (e.g. vector, deque), boost::multi_array, c-like array, etc
newsizesize to resize the timeseries if possible
Template Parameters
timeseriestype of the timeseries collection representation

Definition at line 46 of file resize_if_applicable.hpp.

Referenced by create_square_timeseries(), create_triangle_timeseries(), and resize_if_applicable().

◆ resize_if_applicable() [2/3]

template<typename timeseries >
void jb::testing::resize_if_applicable ( timeseries &  ts,
std::size_t  newsize,
std::false_type   
)

Dummy specialization for non-resizable timeseries collections.

Parameters
tstimeseries are any container representation (e.g. vector, deque), boost::multi_array, c-like array, etc
newsizesize to resize the timeseries if possible
Template Parameters
timeseriestype of the timeseries collection representation

Definition at line 59 of file resize_if_applicable.hpp.

◆ resize_if_applicable() [3/3]

template<typename timeseries >
void jb::testing::resize_if_applicable ( timeseries &  ts,
std::size_t  newsize 
)

Resize a timeseries to a newsize if it is resizable.

Parameters
tstimeseries are any container representation (e.g. vector, deque), boost::multi_array, c-like array, etc
newsizesize to resize the timeseries if possible
Template Parameters
timeseriestype of the timeseries collection representation

Definition at line 72 of file resize_if_applicable.hpp.

References resize_if_applicable().

◆ sum_square()

template<typename container_t >
auto jb::testing::sum_square ( container_t const &  ts)

Compute the sum square of a family of timeseries.

Returns
tde_result with the square sum of each timeseries
Template Parameters
container_ttype of the collection of timeseries

Extract T out of std::complex<T>, otherwise simply T.

Definition at line 17 of file sum_square.hpp.

References jb::detail::element_count(), and jb::detail::nsamples().

Referenced by BOOST_AUTO_TEST_CASE(), and main().

Variable Documentation

◆ compiler

char const jb::testing::compiler[]

The compiler version.

Referenced by main().

◆ compiler_flags

char const jb::testing::compiler_flags[]

The compiler flags.

Referenced by main().

◆ default_initialization_marker

char const jb::testing::default_initialization_marker[] = "__default__"

Definition at line 11 of file initialize_mersenne_twister.hpp.

Referenced by main().

◆ gitrev

char const jb::testing::gitrev[]

The git revision at compile time.

Referenced by main().

◆ linker

char const jb::testing::linker[]

The linker version.

Referenced by main().

◆ uname_a

char const jb::testing::uname_a[]

The kernel version, release, machine hardware, etc.

Referenced by main().