44 using LERR_(INVALID_TIMECODE);
49 Symbol DEFAULT_GRID =
"pal0";
50 Symbol OFFSET_GRID =
"pal10";
59 string const& timeSpec_;
72 TimeValue parsed = FMT::parse (timeSpec_, *grid_);
73 CHECK (parsed == expected,
"parsing '%s' resulted in %s instead of %s" 80 should_yield (
FSecs const& expectedSecs)
82 should_yield (
Time (expectedSecs));
88 VERIFY_ERROR (INVALID_TIMECODE, FMT::parse (timeSpec_, *grid_));
107 defineTestTimeGrids();
110 parseFractionalSeconds();
119 defineTestTimeGrids()
129 Parsing<format::Frames> (
"0#") .should_yield (0);
130 Parsing<format::Frames> (
"1#") .should_yield (
FSecs(1,25) );
131 Parsing<format::Frames> (
"-1#") .should_yield (
FSecs(-1,25) );
132 Parsing<format::Frames> (
"-0#") .should_yield (0);
133 Parsing<format::Frames> (
"25#") .should_yield (1 );
134 Parsing<format::Frames> (
"26#") .should_yield (
Time(40,1) );
135 Parsing<format::Frames> (
"25#", OFFSET_GRID).should_yield (1+10 );
136 Parsing<format::Frames> (
"-1#", OFFSET_GRID).should_yield (10 -
FSecs(1,25));
138 Parsing<format::Frames> (
"23") .should_fail();
139 Parsing<format::Frames> (
"23 #") .should_fail();
140 Parsing<format::Frames> (
"23.#") .should_fail();
141 Parsing<format::Frames> (
"23x#") .should_fail();
143 Parsing<format::Frames> (
"xxx25#xxx") .should_yield (1);
144 Parsing<format::Frames> (
"12 25#") .should_yield (1);
145 Parsing<format::Frames> (
"12 25# 33#") .should_yield (1);
146 Parsing<format::Frames> (
"12 25# \n 33#") .should_yield (1);
147 Parsing<format::Frames> (
"12\n 25# \n 33#") .should_yield (1);
148 Parsing<format::Frames> (
"12.25#") .should_fail();
153 parseFractionalSeconds ()
155 Parsing<format::Seconds> (
"0sec") .should_yield (0);
156 Parsing<format::Seconds> (
"1sec") .should_yield (1);
157 Parsing<format::Seconds> (
"10sec") .should_yield (10);
158 Parsing<format::Seconds> (
"100sec") .should_yield (100);
159 Parsing<format::Seconds> (
"-10sec") .should_yield (-10);
160 Parsing<format::Seconds> (
"-0sec") .should_yield (0);
162 Parsing<format::Seconds> (
"1/2sec") .should_yield (
Time(500,0) );
163 Parsing<format::Seconds> (
"1/25sec") .should_yield (
Time( 40,0) );
164 Parsing<format::Seconds> (
"1/250sec") .should_yield (
Time( 4,0) );
165 Parsing<format::Seconds> (
"1/250sec", OFFSET_GRID).should_yield (
Time(4,10));
167 Parsing<format::Seconds> (
"10/2sec") .should_yield (5);
168 Parsing<format::Seconds> (
"1000/200sec") .should_yield (5);
169 Parsing<format::Seconds> (
"-10/2sec") .should_yield (-5);
170 Parsing<format::Seconds> (
"10/-2sec") .should_fail();
172 Parsing<format::Seconds> (
"1+1/2sec") .should_yield (
Time(500,1) );
173 Parsing<format::Seconds> (
"1-1/2sec") .should_yield (
Time(500,0) );
174 Parsing<format::Seconds> (
"-1-1/2sec") .should_yield (-
Time(500,1) );
175 Parsing<format::Seconds> (
"-1+1/2sec") .should_yield (-
Time(500,0) );
176 Parsing<format::Seconds> (
"-1+1/-2sec") .should_fail();
178 Parsing<format::Seconds> (
"-12+24690/12345sec", OFFSET_GRID).should_yield(0);
180 Parsing<format::Seconds> (
"1") .should_fail();
181 Parsing<format::Seconds> (
"1 sec") .should_fail();
182 Parsing<format::Seconds> (
"--1sec") .should_fail();
183 Parsing<format::Seconds> (
"/-1sec") .should_fail();
184 Parsing<format::Seconds> (
"1.2sec") .should_fail();
185 Parsing<format::Seconds> (
"1/.2sec") .should_fail();
186 Parsing<format::Seconds> (
"1 + 2 / 4 sec") .should_fail();
187 Parsing<format::Seconds> (
"1 + 2 / 4sec") .should_yield(4);
188 Parsing<format::Seconds> (
"xxx4secxxxx") .should_yield(4);
189 Parsing<format::Seconds> (
"x1# 8/2sec 2sec").should_yield(4);
196 UNIMPLEMENTED (
"verify reading hour-minutes-seconds-millis time specs");
209 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.
Simple 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