35 using LERR_(INVALID_TIMECODE);
40 Symbol DEFAULT_GRID =
"pal0";
41 Symbol OFFSET_GRID =
"pal10";
50 string const& timeSpec_;
63 TimeValue parsed = FMT::parse (timeSpec_, *grid_);
64 CHECK (parsed == expected,
"parsing '%s' resulted in %s instead of %s" 71 should_yield (
FSecs const& expectedSecs)
73 should_yield (
Time (expectedSecs));
79 VERIFY_ERROR (INVALID_TIMECODE, FMT::parse (timeSpec_, *grid_));
98 defineTestTimeGrids();
101 parseFractionalSeconds();
110 defineTestTimeGrids()
120 Parsing<format::Frames> (
"0#") .should_yield (0);
121 Parsing<format::Frames> (
"1#") .should_yield (
FSecs(1,25) );
122 Parsing<format::Frames> (
"-1#") .should_yield (
FSecs(-1,25) );
123 Parsing<format::Frames> (
"-0#") .should_yield (0);
124 Parsing<format::Frames> (
"25#") .should_yield (1 );
125 Parsing<format::Frames> (
"26#") .should_yield (
Time(40,1) );
126 Parsing<format::Frames> (
"25#", OFFSET_GRID).should_yield (1+10 );
127 Parsing<format::Frames> (
"-1#", OFFSET_GRID).should_yield (10 -
FSecs(1,25));
129 Parsing<format::Frames> (
"23") .should_fail();
130 Parsing<format::Frames> (
"23 #") .should_fail();
131 Parsing<format::Frames> (
"23.#") .should_fail();
132 Parsing<format::Frames> (
"23x#") .should_fail();
134 Parsing<format::Frames> (
"xxx25#xxx") .should_yield (1);
135 Parsing<format::Frames> (
"12 25#") .should_yield (1);
136 Parsing<format::Frames> (
"12 25# 33#") .should_yield (1);
137 Parsing<format::Frames> (
"12 25# \n 33#") .should_yield (1);
138 Parsing<format::Frames> (
"12\n 25# \n 33#") .should_yield (1);
139 Parsing<format::Frames> (
"12.25#") .should_fail();
144 parseFractionalSeconds ()
146 Parsing<format::Seconds> (
"0sec") .should_yield (0);
147 Parsing<format::Seconds> (
"1sec") .should_yield (1);
148 Parsing<format::Seconds> (
"10sec") .should_yield (10);
149 Parsing<format::Seconds> (
"100sec") .should_yield (100);
150 Parsing<format::Seconds> (
"-10sec") .should_yield (-10);
151 Parsing<format::Seconds> (
"-0sec") .should_yield (0);
153 Parsing<format::Seconds> (
"1/2sec") .should_yield (
Time(500,0) );
154 Parsing<format::Seconds> (
"1/25sec") .should_yield (
Time( 40,0) );
155 Parsing<format::Seconds> (
"1/250sec") .should_yield (
Time( 4,0) );
156 Parsing<format::Seconds> (
"1/250sec", OFFSET_GRID).should_yield (
Time(4,10));
158 Parsing<format::Seconds> (
"10/2sec") .should_yield (5);
159 Parsing<format::Seconds> (
"1000/200sec") .should_yield (5);
160 Parsing<format::Seconds> (
"-10/2sec") .should_yield (-5);
161 Parsing<format::Seconds> (
"10/-2sec") .should_fail();
163 Parsing<format::Seconds> (
"1+1/2sec") .should_yield (
Time(500,1) );
164 Parsing<format::Seconds> (
"1-1/2sec") .should_yield (
Time(500,0) );
165 Parsing<format::Seconds> (
"-1-1/2sec") .should_yield (-
Time(500,1) );
166 Parsing<format::Seconds> (
"-1+1/2sec") .should_yield (-
Time(500,0) );
167 Parsing<format::Seconds> (
"-1+1/-2sec") .should_fail();
169 Parsing<format::Seconds> (
"-12+24690/12345sec", OFFSET_GRID).should_yield(0);
171 Parsing<format::Seconds> (
"1") .should_fail();
172 Parsing<format::Seconds> (
"1 sec") .should_fail();
173 Parsing<format::Seconds> (
"--1sec") .should_fail();
174 Parsing<format::Seconds> (
"/-1sec") .should_fail();
175 Parsing<format::Seconds> (
"1.2sec") .should_fail();
176 Parsing<format::Seconds> (
"1/.2sec") .should_fail();
177 Parsing<format::Seconds> (
"1 + 2 / 4 sec") .should_fail();
178 Parsing<format::Seconds> (
"1 + 2 / 4sec") .should_yield(4);
179 Parsing<format::Seconds> (
"xxx4secxxxx") .should_yield(4);
180 Parsing<format::Seconds> (
"x1# 8/2sec 2sec").should_yield(4);
187 UNIMPLEMENTED (
"verify reading hour-minutes-seconds-millis time specs");
200 UNIMPLEMENTED (
"verify especially SMPTE-drop-frame timecode");
static PQuant retrieve(Symbol gridID)
Access an existing grid definition or quantiser, known by the given symbolic ID.
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Implementation namespace for support and library code.
Lumiera's internal time value datatype.
Token or Atom with distinct identity.
Timecode handling library This header defines the foundation interface TCode to represent a grid alig...
Marker types to indicate a literal string and a Symbol.
Expression builder for writing time value parsing tests.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
A collection of frequently used helper functions to support unit testing.
Library functions to support the formation of grid-aligned time values.
To establish a reference scale for quantised time values.
basic constant internal time value.
static const FrameRate PAL
predefined constant for PAL framerate