[GRASS-git] [OSGeo/grass] 9e0aa0: i.oif: add test file (#6106)

Jayneel Shah noreply at github.com
Fri Jul 25 17:39:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 9e0aa00dae060bec810a7d854fecbcbbb39a7577
      https://github.com/OSGeo/grass/commit/9e0aa00dae060bec810a7d854fecbcbbb39a7577
  Author: Jayneel Shah <80264736+jayneel-shah18 at users.noreply.github.com>
  Date:   2025-07-25 (Fri, 25 Jul 2025)

  Changed paths:
    A scripts/i.oif/testsuite/test_i_oif.py

  Log Message:
  -----------
  i.oif: add test file (#6106)

This PR introduces a regression test suite for the `i.oif` GRASS module. The tests are designed to validate the correctness, reproducibility, and formatting consistency of OIF calculations under synthetic, controlled input conditions.

### Tests Included:
- `test_oif_calculation_and_order`: Validates that OIF values are computed correctly and sorted in descending order for four synthetic input rasters with predictable spatial gradients. Serves as a stable regression benchmark for numerical outputs.
- `test_shell_script_style_output`: Checks that the `-g` flag produces correctly formatted shell-style output with compact comma-separated formatting. Ensures formatting logic does not regress.
- `test_serial_vs_parallel_consistency`: Verifies that running the module in serial mode (`-s`) yields the exact same results as the default parallel mode. Confirms deterministic computation regardless of execution strategy.
- `test_output_to_file`: Ensures that results are correctly written to a specified file using the `output` parameter. Confirms that the file format matches the default `stdout` output exactly.
- `test_constant_raster_yields_nan`: Confirms that any combination involving a constant raster yields `nan` (as expected due to zero variance), while all other combinations produce valid positive OIF values. Asserts numerical and formatting correctness.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list