Skip to content

Commit

Permalink
Add shop creation test script
Browse files Browse the repository at this point in the history
  • Loading branch information
paxed committed Jul 24, 2021
1 parent e2c6cbe commit 120a8c0
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions test/test_shk.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

-- Test shop creation

function shk_test1(doors)
des.map([[
---------
|...|...|
|...+...|
|...|+--|
|----...|
|...|+--|
|...+...|
|...|...|
---------
]]);

des.teleport_region({ region = { 5,1, 7,7 }, dir = "both" });
des.stair("down", 6, 2);
des.stair("up", 6, 6);

des.door("open", 5, 3);
des.door("open", 5, 5);

if (doors == 1) then
des.door("open", 4, 2);
des.door("closed", 4, 6);
end

des.region({ region = { 1,1, 1,1 }, type = "shop", irregular=1, filled=1, lit=1 });
des.region({ region = { 1,5, 1,5 }, type = "shop", irregular=1, filled=1, lit=1 });

if (doors == 2) then
des.door("open", 4, 2);
des.door("closed", 4, 6);
end

end -- shk_test1


function do_test(testfunc, param)
des.reset_level();
des.level_init({ style = "solidfill", fg = " " });
testfunc(param);
des.finalize_level();
end

do_test(shk_test1, 0);
do_test(shk_test1, 1);
do_test(shk_test1, 2);

0 comments on commit 120a8c0

Please sign in to comment.