Browse Source

r3.null: two tests for https://trac.osgeo.org/grass/ticket/2992 (fail)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71420 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 7 years ago
parent
commit
7bf15a7fad

+ 33 - 0
raster3d/r3.null/testsuite/test_r3_null_ticket_2992_more_nulls.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Tests for r3.null, Trac ticket #2992 I
+# replacing values by NULLs creates too many NULLs
+
+set -e
+set -x
+
+# setup
+
+# works in NC SPM
+
+g.region -3 n=220180 s=219900 w=638360 e=638720 t=153 b=106 res=2 res3=2
+
+r3.mapcalc expr="test_1 = float(col() + row() + depth())"
+
+# test
+
+# cols, rows numbered in rast algebra from 1,
+# so there should be one cell with value 3
+
+r3.null map=test_1 setnull=3
+eval `r3.univar map=test_1 -g | grep null_cells`
+reference=1
+
+if (( $null_cells != $reference )) ; then
+    >&2 echo "Wrong number of NULL cells ($null_cells != $reference)"
+    exit 1
+fi
+
+# cleanup
+
+g.remove -f type=rast3 name=test_1

+ 33 - 0
raster3d/r3.null/testsuite/test_r3_null_ticket_2992_null_by_value.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Tests for r3.null, Trac ticket #2992 II
+# replacing (non-existing) NULLs by values creates NULLs
+
+set -e
+set -x
+
+# setup
+
+# works in NC SPM
+
+g.region -3 n=220180 s=219900 w=638360 e=638720 t=153 b=106 res=2 res3=2
+
+r3.mapcalc expr="test_1 = float(col() + row() + depth())"
+
+# test
+
+# there were no NULLs to start with,
+# so there should be none afterwards
+
+r3.null map=test_1 null=10
+eval `r3.univar map=test_1 -g | grep null_cells`
+reference=0
+
+if (( $null_cells != $reference )) ; then
+    >&2 echo "Wrong number of NULL cells ($null_cells != $reference)"
+    exit 1
+fi
+
+# cleanup
+
+g.remove -f type=rast3 name=test_1