25#include <boost/lexical_cast.hpp>
27using boost::lexical_cast;
48 FSecs refval = isnil(arg)? 1 : lexical_cast<long> (arg[1]);
70 CHECK (zero == (var - 2*(ref + two)) );
73 CHECK (zero == (var - ref));
84 CHECK (zero ==
Time());
89 CHECK ( (var == ref) );
90 CHECK (!(var != ref) );
91 CHECK ( (var >= ref) );
92 CHECK ( (var <= ref) );
93 CHECK (!(var < ref) );
94 CHECK (!(var > ref) );
96 var +=
Time(FSecs(2));
97 CHECK (!(var == ref) );
98 CHECK ( (var != ref) );
99 CHECK ( (var >= ref) );
100 CHECK (!(var <= ref) );
101 CHECK (!(var < ref) );
102 CHECK ( (var > ref) );
104 raw_time_64 rat = _raw(var);
105 CHECK (!(rat == ref) );
106 CHECK ( (rat != ref) );
107 CHECK ( (rat >= ref) );
108 CHECK (!(rat <= ref) );
109 CHECK (!(rat < ref) );
110 CHECK ( (rat > ref) );
112 CHECK ( (var == rat) );
113 CHECK (!(var != rat) );
114 CHECK ( (var >= rat) );
115 CHECK ( (var <= rat) );
116 CHECK (!(var < rat) );
117 CHECK (!(var > rat) );
125 CHECK (t1 ==
"0:00:02.008"_expect);
128 CHECK (t2 ==
"0:01:30.008"_expect);
130 Time t3(2008,118,58);
131 CHECK (t3 ==
"1:00:00.008"_expect);
134 CHECK (t4 ==
"-0:58:30.000"_expect);
137 CHECK (
Time::MAX ==
"85401592:56:01.825"_expect);
138 CHECK (
Time::MIN ==
"-85401592:56:01.825"_expect);
142 int millis = 1 +
rani (999);
143 int secs =
rani (60);
144 int mins =
rani (60);
145 int hours =
rani (100);
153 CHECK (millis == (_raw(
randTime) / TIME_SCALE_ms ) % 1000);
154 CHECK (secs == (_raw(
randTime) / TIME_SCALE_sec) % 60);
155 CHECK (mins == (_raw(
randTime) / TIME_SCALE_sec / 60) % 60);
156 CHECK (hours == _raw(
randTime) / TIME_SCALE_sec / 60 / 60);
void checkBasics(Time const &ref)
void checkComponentBreakdown()
virtual void run(Arg arg)
void checkComparisons(Time const &ref)
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.
lib::time::Time randTime()
create a random but not insane Time value between 1s ... 10min + 500ms
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)
Generating (pseudo) random numbers with controlled seed.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
A collection of frequently used helper functions to support unit testing.
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...