rngtest::StatTest class

Random number generator statistical test.

This class uses runtime polymorphism without client-side inheritance: inheritance is confined to the internals of the this class, invisible to client-code. The class exclusively deals with ownership enabling client-side value semantics. Credit goes to Sean Parent at Adobe: https://github.com/sean-parent/sean-parent.github.com/wiki/ Papers-and-Presentations. For example client code that models a Battery, see rngtest::TestU01.

Constructors, destructors, conversion operators

template<typename T>
StatTest(T x) explicit
Constructor taking an object modeling Concept.
template<typename T, typename std::enable_if<!tk::HasTypedefProxy<T>::value, int>::type = 0>
StatTest(std::function<T()> x) explicit
Constructor taking a std::function holding a constructor bound to its arguments of an object modeling Concept (see below)
template<typename T, typename... ConstrArgs, typename std::enable_if<tk::HasTypedefProxy<T>::value, int>::type = 0>
StatTest(std::function<T()> c, ConstrArgs... args) explicit
Constructor taking a function pointer to a constructor of an object modeling Concept.
StatTest(const StatTest& x)
Copy constructor.
StatTest(StatTest&&) noexcept defaulted
Move constructor.

Public functions

void npval() const
Public interface to contribute number of results/test, i.e., p-values.
void names() const
Public interface to contribute test name(s)
void run() const
Public interface to running a test.
void time() const
Public interface to contributing a test's run time measured in seconds.
auto operator=(const StatTest& x) -> StatTest&
Copy assignment.
auto operator=(StatTest&&) noexcept -> StatTest& defaulted
Move assignment.

Function documentation

template<typename T>
rngtest::StatTest::StatTest(T x) explicit

Constructor taking an object modeling Concept.

Parameters
in Instantiated object of type T given by the template argument.

The object of class T comes pre-constructed.

template<typename T, typename std::enable_if<!tk::HasTypedefProxy<T>::value, int>::type = 0>
rngtest::StatTest::StatTest(std::function<T()> x) explicit

Constructor taking a std::function holding a constructor bound to its arguments of an object modeling Concept (see below)

Parameters
in Function pointer to a constructor bound of an object modeling Concept

Passing std::function allows late execution of the constructor of T, i.e., as late as inside this class' constructor, and thus usage from a factory. Object of T is constructed here. This overload is disabled for Charm++ chare objects defining typedef 'Proxy', see also below.

template<typename T, typename... ConstrArgs, typename std::enable_if<tk::HasTypedefProxy<T>::value, int>::type = 0>
rngtest::StatTest::StatTest(std::function<T()> c, ConstrArgs... args) explicit

Constructor taking a function pointer to a constructor of an object modeling Concept.

Parameters
in Function pointer to a constructor of an object modeling Concept
args in Constructor arguments

Passing std::function allows late execution of the constructor of T, i.e., at some future time, and thus usage from a factory. Note that the value of the first function argument, std::function<T()>, is not used here, but its constructor type, T, is used to enable the compiler to deduce the model constructor type, used to create its Charm proxy, defined by T::Proxy. The actual constructor of T is not called here but at some future time by the Charm++ runtime system, here only an asynchrounous ckNew() is called, i.e., a message (or request) for a future call to T's constructor. This overload is only enabled for Charm++ chare objects defining typedef 'Proxy', which must define the Charm++ proxy. All optional constructor arguments are forwarded to ckNew() and thus to T's constructor. If it was somehow possible to obtain all bound arguments' types and values from an already-bound std::function, we could use those instead of having to explicitly forward the model constructor arguments via this host constructor.