25#include <boost/lexical_cast.hpp>
28using boost::lexical_cast;
32using LERR_(BOTTOM_VALUE);
53 return 1 +
rani(10000);
56 return lexical_cast<raw_time_64> (arg[1]);
131 CHECK (zero == (var - 2*(org + two)) );
134 CHECK (var == 2*two + org + org);
138 CHECK (zero == (var - org));
147 CHECK (raw > org - two);
150 CHECK (zero == -var + var);
151 CHECK (zero != -var);
174 CHECK (0.5 == boost::rational_cast<double> (halve));
185 CHECK (
"1:01:01.001" ==
string(tx3));
190 CHECK (((t1-th)*=2) == t1);
205 size_t hh =
sizeof(size_t)*CHAR_BIT/2;
206 CHECK (
size_t(1)<<hh == hashFunc (
TimeValue{1}));
207 CHECK (
size_t(1) == hashFunc (
TimeValue(
size_t(1)<<hh)));
209 size_t h1 = hashFunc (org);
213 CHECK (h2 - h1 ==
size_t(1)<<hh);
214 CHECK (h3 ==
size_t(_raw(org)));
263 Offset reverse(point,org);
264 CHECK (reverse < off5);
265 CHECK (reverse.
abs() == off5);
267 CHECK (0 == off5 + reverse);
273 CHECK (7 == -2*off9 + off5*5);
292 Offset backwards(point,org);
293 CHECK (backwards < zero);
296 CHECK (distance > zero);
297 CHECK (distance == backwards.
abs());
300 CHECK (len1 ==
Time(
FSecs(23,1000)) +
Time(0, 4 + 5*60 + 6*3600));
307 CHECK (
Time(0,2,0,0) == unit);
319 CHECK (point < zero);
320 CHECK (point < backwards);
322 CHECK (distance + point < zero);
323 CHECK (distance == backwards.
abs());
331 CHECK (_raw(
Time::MAX) < std::numeric_limits<int64_t>::max());
332 CHECK (_raw(
Time::MIN) > std::numeric_limits<int64_t>::min());
344 CHECK (_raw(
Duration::MAX) < std::numeric_limits<int64_t>::max());
371 typedef boost::rational<FrameCnt> Frac;
375 Offset o1 = Frac(1,2) * three;
379 Offset o2 = -Frac(1,2) * three;
383 CHECK (three * Frac(1,2) * 2 != three);
384 CHECK (three *(Frac(1,2) * 2) == three);
398 CHECK (org == interval);
402 CHECK (theLength ==
Offset(org,five).abs());
404 Time endpoint = interval.
end();
407 CHECK (
Offset(interval,endpoint) ==
Offset(org,five).abs());
410 cout <<
"Interval-1: " << interval
411 <<
" Interval-2: " << successor
412 <<
" End point: " << successor.
end()
425 CHECK (span1 == span2);
426 CHECK (span2 == span1);
427 CHECK (span3 == span4);
428 CHECK (span4 == span3);
430 CHECK (span1 != span3);
431 CHECK (span3 != span1);
432 CHECK (span1 != span4);
433 CHECK (span4 != span1);
434 CHECK (span2 != span3);
435 CHECK (span3 != span2);
436 CHECK (span2 != span4);
437 CHECK (span4 != span2);
440 CHECK (span1.
end() == span2.
end());
441 CHECK (span3.
end() == span4.
end());
448 CHECK (span1 != span1x);
449 CHECK (span3 != span3y);
450 CHECK (span3 != span3z);
452 CHECK ( span1 < span1x);
453 CHECK ( span1 <= span1x);
454 CHECK (!(span1 > span1x));
455 CHECK (!(span1 >= span1x));
457 CHECK ( span3 > span3y);
458 CHECK ( span3 >= span3y);
459 CHECK (!(span3 < span3y));
460 CHECK (!(span3 <= span3y));
462 CHECK ( span3 < span3z);
463 CHECK ( span3y < span3z);
467 CHECK (span1 < span1x);
470 CHECK (span1.
end() < span1x.
end());
472 CHECK (span3 > span3y);
475 CHECK (span3.
end() > span3y.
end());
476 CHECK (
Time(span3) ==
Time(span3y));
478 CHECK (span3 < span3z);
481 CHECK (span3.
end() != span3z.
end());
484 CHECK (span3y < span3z);
487 CHECK (span3y.
end() < span3z.
end());
Duration is the internal Lumiera time metric.
static const Duration MAX
maximum possible temporal extension
static const Duration NIL
constant to indicate "no duration"
Framerate specified as frames per second.
static const FrameRate PAL
predefined constant for PAL framerate
static FrameRate approx(double fps)
static const FrameRate NTSC
Offset measures a distance in time.
Duration abs() const
interpret the distance given by this offset as a time duration
A time interval anchored at a specific point in time.
bool contains(TimeValue const &tp) const
basic constant internal time value.
static const raw_time_64 SCALE
Number of micro ticks (µs) per second as basic time scale.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
void createOffsets(TimeValue org)
void verify_extremeValues()
void verify_fractionalOffset()
virtual void run(Arg arg)
void checkMutableTime(TimeValue org)
void checkTimeHash(TimeValue org)
void checkTimeConvenience(TimeValue org)
raw_time_64 random_or_get(Arg arg)
void buildDuration(TimeValue org)
void verify_invalidFramerateProtection()
void checkBasicTimeValues(TimeValue org)
void buildTimeSpan(TimeValue org)
void compareTimeSpan(Time const &org)
void relateTimeIntervals(TimeValue org)
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_)
Primary class template for std::hash.
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.
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...