27using lumiera::error::LUMIERA_ERROR_ASSERTION;
50 static double prevVal;
51 if (arbitrary != prevVal)
86 digxel->setValueRaw (val);
96 digxel->setValueRaw (val);
102 digxel->setValueRaw ((+1 < value2set) ? +1.0
103 : (-1 > value2set) ? -1.0
110 digxel->setValueRaw (value2set);
162 CHECK (
"## +0.0 ##" ==
string(digi));
163 cout <<
"empty____" << digi << endl;
166 CHECK (-88.77 == digi);
167 CHECK (
"##-88.8 ##" ==
string(digi));
168 cout <<
"value____" << digi << endl;
178 digi.installMutator (sideeffectSum, digi);
182 for (
uint i=0; i < REPEAT; ++i)
184 double arbitrary = randomFrac();
185 checksum += arbitrary;
189 CHECK (sum == checksum,
"divergence after adding %f in iteration %d", arbitrary, i);
190 CHECK (digi == arbitrary);
204 CHECK (12.3 == digi);
207 digi.installMutator (limitingMutator, digi);
208 CHECK (12.3 == digi);
210 CHECK (12.3 == digi);
217 CHECK (-0.678 == digi);
221 digi.setValueRaw(12.3);
222 CHECK (12.3 == digi);
235 digi.installMutator (protocollingMutator, digi);
238 CHECK ( 0.0 == preval and 12.3 == newval);
240 CHECK (12.3 == preval and 22.3 == newval);
242 CHECK (22.3 == preval and 17.3 == newval);
244 CHECK (17.3 == preval and 18.3 == newval);
246 CHECK (18.3 == preval and 19.3 == newval);
248 CHECK (19.3 == preval and 18.3 == newval);
250 CHECK (18.3 == preval and 17.3 == newval);
253 CHECK (18.3 == digi and 18.3 == val);
255 CHECK (19.3 == digi and 18.3 == val);
257 CHECK (18.3 == digi and 18.3 == val);
259 CHECK (17.3 == digi and 18.3 == val);
271 double someValue = d1 + randomFrac();
274 CHECK (d1 == someValue);
293 double someValue = randomFrac();
296 CHECK (d1 == someValue);
299 CHECK (d2 == someValue);
300 CHECK (not isSameObject (d1, d2));
304 CHECK (d2 == someValue);
314 digi = 123456789.12345678;
319 formatted = digi.show();
322 CHECK (formatted.length() <= digi.maxlen());
341 clock_t start(0), stop(0);
342 util::_Fmt resultDisplay(
"timings(%s)%|36T.|%4.0fns\n");
344#define START_TIMINGS start=clock();
345#define DISPLAY_TIMINGS(ID)\
347 uint ID = stop-start;\
348 cout << resultDisplay % STRINGIFY (ID) % (double(ID)/CLOCKS_PER_SEC/TIMING_CNT*1e9) ;
352 for (
uint i=0; i < TIMING_CNT; ++i)
360 for (
uint i=0; i < TIMING_CNT; ++i)
369 for (
uint i=0; i < TIMING_CNT; ++i)
376 digi.installMutator (emptyMutator, digi);
379 for (
uint i=0; i < TIMING_CNT; ++i)
386 digi.installMutator (trivialMutator, digi);
389 for (
uint i=0; i < TIMING_CNT; ++i)
396 digi.installMutator (&TestDigxel::setValueRaw, digi);
399 for (
uint i=0; i < TIMING_CNT; ++i)
406 CHECK (without_reformatting < with_reformatting);
A number element for building structured numeric displays.
void timingMeasurements()
virtual void run(Arg arg)
void checkDisplayOverrun()
void verifyMutatorInfluence()
void verifyAssignMutatingOperators()
A front-end for using printf-style formatting.
#define DISPLAY_TIMINGS(ID)
A self-contained numeric element for building structured numeric displays.
void sideeffectSum(TestDigxel *digxel, double val)
void trivialMutator(TestDigxel *digxel, double value2set)
Digxel< double, VerySpecialFormat > TestDigxel
void protocollingMutator(TestDigxel *digxel, double val)
void emptyMutator(TestDigxel *, double)
void limitingMutator(TestDigxel *digxel, double value2set)
Implementation namespace for support and library code.
int rani(uint bound=_iBOUND())
Test runner and basic definitions for tests.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
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.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...