31#include <boost/lexical_cast.hpp>
35using boost::lexical_cast;
51 using LERR_(UNCONNECTED);
60 if (isnil (arg))
return "";
61 string entry = arg[0];
62 arg.erase (arg.begin());
82 : received_{TI{
Time::ZERO}}
86 : received_{initialValue}
90 operator() (TI
const& changeValue)
const
92 received_ = changeValue;
129 return lexical_cast<raw_time_64> (arg);
140 CHECK (c!=
Time::ZERO and o != c,
"unsuitable testdata");
159 TestListener<Time> follower;
163 target.
accept (controller);
164 CHECK (
Time(0,10) == target);
166 CHECK (
Time(500,10) == target);
168 CHECK (follower.receivedValue() ==
Time::ZERO);
170 CHECK (follower.receivedValue() ==
Time(500,10));
173 CHECK (
Time(0,9) == target);
174 CHECK (
Time(0,9) == follower.receivedValue());
194 return std::is_same<T,Duration>::value;
201 return std::is_same<T,QuTime>::value;
214 return grid->materialise (alignedTime);
244 return QuTime (org,
"test_grid_PAL");
275 return QuTime (c,
"test_grid_NTSC");
281 template<
class TAR,
class SRC>
285 if (isDuration<TAR>())
287 CHECK (target == org,
"Logic error: Duration was changed by time value");
290 if (isDuration<SRC>())
292 CHECK (target == org,
"Logic error: Duration used to change time value");
297 CHECK (target != org);
302 CHECK (target != org);
303 CHECK (target == change);
310 CHECK (target != org);
311 CHECK (target == otherDuration);
316 CHECK (target != org);
317 CHECK (target == span_as_change.
duration());
322 CHECK (target == org,
"Logic error: Duration was used as start point of the target TimeSpan");
323 CHECK (target.
duration() !=
Time(
FSecs(3,2)),
"length of the timespan should have been changed");
324 CHECK (target.
duration() == changedDur);
333 CHECK (target != refState);
334 CHECK (target ==
Time(refState)+offset);
341 CHECK (target == refState);
349 CHECK (target != refState or not offsetSteps);
356 CHECK (target != refState or not offsetSteps);
362 template<
class TAR,
class SRC>
366 if (isDuration<SRC>())
395 CHECK (targetDuration == follower.
receivedValue().duration());
411 cout <<
"Test-Case. Target=" << typeStr<TAR>()
412 <<
"\t <--feed--- " << typeStr<SRC>()
423 target.accept (controller);
429 TAR refState(target);
434 controller (-offset);
450 int maxInt = std::numeric_limits<int>::max();
451 int minInt = std::numeric_limits<int>::min();
463 BASE::performTestSequence(org,c);
485 TestMatrix().performTestSequence(origVal, change);
Frontend/Interface: controller-element to retrieve and change running time values.
void connectChangeNotification(SIG const &toNotify)
install a callback functor to be invoked as notification for any changes imposed onto the observed ti...
Duration is the internal Lumiera time metric.
static const Duration NIL
constant to indicate "no duration"
static const FrameRate PAL
predefined constant for PAL framerate
static const FrameRate NTSC
Offset measures a distance in time.
grid aligned time specification, referring to a specific scale.
A time interval anchored at a specific point in time.
void accept(Mutation const &)
may change start / duration
basic constant internal time value.
static const raw_time_64 SCALE
Number of micro ticks (µs) per second as basic time scale.
Lumiera's internal time value datatype.
virtual void run(Arg arg)
void verifyMatrix_of_MutationCases(TimeValue const &o, TimeValue const &c)
raw_time_64 random_or_get(string arg)
Mock object to receive change notifications.
TI const & receivedValue() const
ItemWrapper< TI > received_
TestListener(TI const &initialValue)
Universal value/ref wrapper accessible similar to a pointer.
Any copy and copy construction prohibited.
Manipulating and monitoring time entities with life changes.
Metaprogramming facilities to generate combination cases.
Adapter to store and hold an element of arbitrary type in local storage.
TimeValue materialise(T const &someTime)
void ____verify_notification(TAR const &target, TestListener< SRC > const &follower)
void ____verify_nudged(TAR const &target, TAR const &refState, FrameCnt offsetSteps)
void ____verify_wasChanged(TAR const &target, TimeValue const &org, SRC const &change)
void ____verify_wasOffset(TAR const &target, TAR const &refState, Offset const &offset)
void ____verify_wasOffsetBack(TAR const &target, TAR const &refState)
int64_t FrameCnt
relative framecount or frame number.
std::shared_ptr< const Quantiser > PQuant
int64_t raw_time_64
Raw µ-tick time representation used in Lumiera.
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Implementation namespace for support and library code.
int rani(uint bound=_iBOUND())
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
void performTestSequence(TimeValue const &, TimeValue const &)
void performTestSequence(TimeValue const &org, TimeValue const &c)
static QuTime prepareChangeValue(TimeValue const &c)
static TimeSpan prepareChangeValue(TimeValue const &c)
static SRC prepareChangeValue(TimeValue const &c)
static QuTime build(TimeValue const &org)
static TimeSpan build(TimeValue const &org)
static TAR build(TimeValue const &org)
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
To establish a reference scale for quantised time values.
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
a family of time value like entities and their relationships.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...