<div dir="ltr">On Fri, Oct 2, 2015 at 7:12 PM, Seth Price <span dir="ltr"><<a href="mailto:seth@planet.com" target="_blank">seth@planet.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I imagine the best test will need pretty low level access to the cellhd structure to look at the compression flags. Is that what you mean? Or would a better way include looking at the output of `r.compress`?</div>
</blockquote></div><br></div><div class="gmail_extra">Yes, best would be to test the individual functions on the lowest level (lib/raster3d and raster3d/r3.flow). However, this is hard to do (you need to write a C program* and implement all tests yourself). I suggest to start with high level tests; this is much easier (you need to write a script ideally using existing Python packages).<br><br>Comparing r.univar output for a raster map before and after r.compress execution sounds like a good start. For the testing framework, the right approach is to copy and existing map to the current Mapset, run r.univar to get the output, run r.compress, run r.univar again and diff the results. This can be done in Bash or Python; Bash looks simpler at the beginning, but existing functionally in Python (esp. the gunittest package) will make things easier at the end.<br><br></div><div class="gmail_extra">Vaclav<br></div><div class="gmail_extra"><br><br>Some gunittest references:<br><a href="https://grass.osgeo.org/grass71/manuals/libpython/gunittest_testing.html#tests-of-grass-modules">https://grass.osgeo.org/grass71/manuals/libpython/gunittest_testing.html#tests-of-grass-modules</a><br><a href="https://grass.osgeo.org/grass71/manuals/libpython/gunittest.html#gunittest.case.TestCase.runModule">https://grass.osgeo.org/grass71/manuals/libpython/gunittest.html#gunittest.case.TestCase.runModule</a><br><a href="https://grass.osgeo.org/grass71/manuals/libpython/gunittest.html#gunittest.case.TestCase.assertModuleKeyValue">https://grass.osgeo.org/grass71/manuals/libpython/gunittest.html#gunittest.case.TestCase.assertModuleKeyValue</a><br><br></div><div class="gmail_extra">* Parts of library which are available through ctypes can be also tested relatively easily in Python without a need to write a wrapper C program.<br></div></div>