]> granicus.if.org Git - nethack/commitdiff
Test for replace_terrain coordinates
authorPasi Kallinen <paxed@alt.org>
Fri, 3 Sep 2021 05:27:17 +0000 (08:27 +0300)
committerPasi Kallinen <paxed@alt.org>
Fri, 3 Sep 2021 05:27:17 +0000 (08:27 +0300)
test/test_des.lua

index 063aeabf97dbd360ad0aa32eead28f97ac308adc..acc378c76c4659449572f250e12208e283c1b142 100644 (file)
@@ -458,6 +458,22 @@ function test_terrain()
 end
 
 function test_replace_terrain()
+   des.reset_level();
+   des.replace_terrain({ x1=2, y1=3, x2=4,y2=5, fromterrain=" ", toterrain="I", lit=1 });
+   for x = 2,4 do
+      for y = 3,5 do
+         is_map_at(x,y, "I", true);
+      end
+   end
+   for x = 1,5 do
+      is_map_at(x,2, " ", false);
+      is_map_at(x,6, " ", false);
+   end
+   for y = 2,6 do
+      is_map_at(1, y, " ", false);
+      is_map_at(5, y, " ", false);
+   end
+
    des.replace_terrain({ x1=1, y1=1, x2=70,y2=19, fromterrain=".", toterrain="I", lit=1 });
    des.replace_terrain({ x1=1, y1=1, x2=70,y2=19, fromterrain=".", toterrain="I", chance=50 });
    des.replace_terrain({ region={1,1, 70,19}, fromterrain=".", toterrain="L", chance=25 });