Zoom Init test fixed and improved
This branch started simply fixing testZoomInit
. It does this by:
- Initialising the mock space with
bzero
. - Setting
with_zoom_region
which was left unset after changing from a parameter to a runtime argument in the main code. - Ensuring the engine is set to
NULL
to stop the test looking for gravity properties that don't exist. - Using a different zoom region extent for each zoom region definition to be more true to their actual use (i.e. small, large and intermediate zoom region sizes relative to the parent box).
I also expanded the test to ensure the code was behaving as expected w.r.t cell grid alignment (also done on a downstream branch in a debugging check). In another win for unit testing, this immediately highlighted that the test constructed an edge case where the zoom and buffer cells were offset by half a buffer cell. Thus this MR also ensures the buffer cells and zoom cells align by ensuring the buffer cdim
is odd before applying region_buffer_ratio
. The zoom region boundaries are set to be exactly buffer_width * region_buffer_ratio / 2
away from the centre of the box (explicitly what is expected for them to align).
I also did some light cleaning in zoom_region_init
while I implemented the above fix:
- The different
zoom_get_cell_props...
functions now don't take arguments since they were unnecessary in the grand scheme of things. - The zoom
dim
is now checked for all methods instead of just the buffer cell method for safety's sake. - The buffer bounds are reported in the zoom properties report as a sanity check.
- The strange passing of a pointer to a double for
max_dim
has been removed. - The check of whether zoom region padding had been increased too far previously wasn't quite right, it errored for any padding >2 rather than checking the user-specified padding hadn't been increased too far. This has now been fixed to compare the user-specified padding factor with the true padding factor found after computing the zoom region properties.