Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ladders unittest #2924

Merged
merged 14 commits into from
Jul 2, 2017
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dmm map merger hook
# needs additional setup, see tools/mapmerge/install.txt
*.dmm merge=merge-dmm
*.dmm merge=merge-dmm eol=crlf

# dmi icon merger hook
# needs additional setup, see tools/dmitool/merging.txt
Expand Down
49 changes: 46 additions & 3 deletions code/unit_tests/map_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Map Unit Tests.
* Zone checks / APC / Scrubber / Vent.
*
*
*
*/

Expand Down Expand Up @@ -65,13 +65,13 @@ datum/unit_test/apc_area_test/start_test()
if(!A.air_vent_info.len && !(A.type in exempt_from_atmos))
log_unit_test("[bad_msg] lacks an Air vent.[ascii_reset]")
area_good = 0

if(!area_good)
bad_areas.Add(A)

if(bad_areas.len)
fail("\[[bad_areas.len]/[area_test_count]\]Some areas lacked APCs, Air Scrubbers, or Air vents.")
else
else
pass("All \[[area_test_count]\] areas contained APCs, Air scrubbers, and Air vents.")

return 1
Expand Down Expand Up @@ -141,5 +141,48 @@ datum/unit_test/wire_test/start_test()

return 1

#define BLOCKED_UP 1
#define BLOCKED_DOWN 2

/datum/unit_test/ladder_test
name = "MAP: Ladder Test (Station)"

/datum/unit_test/ladder_test/start_test()
var/ladders_total = 0
var/ladders_incomplete = 0
var/ladders_blocked = 0

for (var/obj/structure/ladder/ladder in world)
if (ladder.z in config.admin_levels)
continue

ladders_total++

if (!ladder.target_up && !ladder.target_down)
ladders_incomplete++
log_unit_test("[ascii_red]--------------- [ladder.name] \[[ladder.x] / [ladder.y] / [ladder.z]\] Is incomplete.")
continue

var/bad = 0
if (ladder.target_up && !istype(GetAbove(ladder), /turf/simulated/open))
bad |= BLOCKED_UP

if (ladder.target_down && !istype(ladder.loc, /turf/simulated/open))
bad |= BLOCKED_DOWN

if (bad)
ladders_blocked++
log_unit_test("[ascii_red]--------------- [ladder.name] \[[ladder.x] / [ladder.y] / [ladder.z]\] Is blocked in dirs:[(bad & BLOCKED_UP) ? " UP" : ""][(bad & BLOCKED_DOWN) ? " DOWN" : ""].")

if (ladders_blocked || ladders_incomplete)
fail("\[[ladders_blocked + ladders_incomplete] / [ladders_total]\] ladders were bad.[ladders_blocked ? " [ladders_blocked] blocked." : ""][ladders_incomplete ? " [ladders_incomplete] incomplete." : ""]")
else
pass("All [ladders_total] ladders were okay.")

return 1

#undef BLOCKED_UP
#undef BLOCKED_DOWN

#undef SUCCESS
#undef FAILURE
Loading