Skip to content

Timeline unit tests

Mladen Ivkovic requested to merge timeline_unit_test into master

So given some recent trouble with the RT subcycling in connection with the timeline related functions, I deemed it beneficial to write up unit tests for them as an extra check whether they are performing what they are supposed to or not.

Unfortunately, unless I fundamentally misunderstand something, it looks to me like they are not.

I started up this draft with a check for get_integer_time_end(), and it fails for me for "small" time bins (<= 21).

The current implementation of tests/testTimeline.c fails for me with the message:

[09470.4] testTimeline.c:test_get_integer_time_end():109: time_end incorrect: expect=126460514074099712 got=126460514069905408 diff=4194304; current=126460514069905413 displacement=4194299, dt=4194304

I'd appreciate a second pair of eyes here.

On a second note, I also tried implementing and testing a integer operations only version of get_integer_time_end() function, and have put it inside the test.

It passes the same checks I engineered for the current implementation of the function, with one caveat: **If the current time is also the end time for a given timestep determined by a particle time bin, then the resulting time_end will be the end time of the next time step. ** This is not the same behaviour as the current implementation has.

To clarify:

Let dt = 2, ti_current = 10.

Then get_integer_time_end(ti_current, bin) = 10 in the current implementation, but get_integer_time_end_INTEGER_OPERATIONS_ONLY(ti_current, bin) = 12

Edited by Mladen Ivkovic

Merge request reports