From 8ebfe228ccdd7e48fd976c4bbbbbf984df99e97f Mon Sep 17 00:00:00 2001 From: Werner Date: Sun, 14 Oct 2018 11:30:30 +0200 Subject: [PATCH] More Unittests (#5417) * Add unittests for bad doors, bad firedoors and bad pipes * Ignore non-station-levels * Fix invalid firedoor on exodus --- code/unit_tests/map_tests.dm | 104 +++++++++++ maps/exodus/exodus-1_station.dmm | 304 +------------------------------ 2 files changed, 105 insertions(+), 303 deletions(-) diff --git a/code/unit_tests/map_tests.dm b/code/unit_tests/map_tests.dm index bf3f6e345a1..efc676fe250 100644 --- a/code/unit_tests/map_tests.dm +++ b/code/unit_tests/map_tests.dm @@ -163,5 +163,109 @@ datum/unit_test/wire_test/start_test() #undef BLOCKED_UP #undef BLOCKED_DOWN +/datum/unit_test/bad_doors + name = "MAP: Check for bad doors" + +/datum/unit_test/bad_doors/start_test() + var/checks = 0 + var/failed_checks = 0 + for(var/obj/machinery/door/airlock/A in world) + var/turf/T = get_turf(A) + if(!(T.z in current_map.station_levels)) + continue + checks++ + if(istype(T, /turf/space) || istype(T, /turf/simulated/floor/asteroid) || isopenturf(T) || T.density) + failed_checks++ + log_unit_test("Airlock [A] with bad turf at ([A.x],[A.y],[A.z]) in [T.loc].") + + if(failed_checks) + fail("\[[failed_checks] / [checks]\] Some doors had improper turfs below them.") + else + pass("All \[[checks]\] doors have proper turfs below them.") + + return 1 + +/datum/unit_test/bad_firedoors + name = "MAP: Check for bad firedoors" + +/datum/unit_test/bad_firedoors/start_test() + var/checks = 0 + var/failed_checks = 0 + for(var/obj/machinery/door/firedoor/F in world) + var/turf/T = get_turf(F) + if(!(T.z in current_map.station_levels)) + continue + checks++ + var/firelock_increment = 0 + for(var/obj/machinery/door/firedoor/FD in T) + firelock_increment += 1 + if(firelock_increment > 1) + failed_checks++ + log_unit_test("Double firedoor [F] at ([F.x],[F.y],[F.z]) in [T.loc].") + else if(istype(T, /turf/space) || istype(T, /turf/simulated/floor/asteroid) || isopenturf(T) || T.density) + failed_checks++ + log_unit_test("Firedoor with bad turf at ([F.x],[F.y],[F.z]) in [T.loc].") + + if(failed_checks) + fail("\[[failed_checks] / [checks]\] Some firedoors were doubled up or had bad turfs below them.") + else + pass("All \[[checks]\] firedoors have proper turfs below them and are not doubled up.") + + return 1 + +/datum/unit_test/bad_piping + name = "MAP: Check for bad piping" + +/datum/unit_test/bad_piping/start_test() + set background = 1 + var/checks = 0 + var/failed_checks = 0 + + //all plumbing - yes, some things might get stated twice, doesn't matter. + for (var/obj/machinery/atmospherics/plumbing in world) + if(!(plumbing.z in current_map.station_levels)) + continue + checks++ + if (plumbing.nodealert) + failed_checks++ + log_unit_test("Unconnected [plumbing.name] located at [plumbing.x],[plumbing.y],[plumbing.z] ([get_area(plumbing.loc)])") + + //Manifolds + for (var/obj/machinery/atmospherics/pipe/manifold/pipe in world) + if(!(pipe.z in current_map.station_levels)) + continue + checks++ + if (!pipe.node1 || !pipe.node2 || !pipe.node3) + failed_checks++ + log_unit_test("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])") + + //Pipes + for (var/obj/machinery/atmospherics/pipe/simple/pipe in world) + if(!(pipe.z in current_map.station_levels)) + continue + checks++ + if (!pipe.node1 || !pipe.node2) + failed_checks++ + log_unit_test("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])") + + next_turf: + for(var/turf/T in turfs) + for(var/dir in cardinal) + var/list/connect_types = list(1 = 0, 2 = 0, 3 = 0) + for(var/obj/machinery/atmospherics/pipe in T) + checks++ + if(dir & pipe.initialize_directions) + for(var/connect_type in pipe.connect_types) + connect_types[connect_type] += 1 + if(connect_types[1] > 1 || connect_types[2] > 1 || connect_types[3] > 1) + log_unit_test("Overlapping pipe ([pipe.name]) located at [T.x],[T.y],[T.z] ([get_area(T)])") + continue next_turf + if(failed_checks) + fail("\[[failed_checks] / [checks]\] Some pipes are not properly connected or doubled up.") + else + pass("All \[[checks]\] pipes are properly connected and not doubled up.") + + return 1 + #undef SUCCESS #undef FAILURE diff --git a/maps/exodus/exodus-1_station.dmm b/maps/exodus/exodus-1_station.dmm index dc37d7a4f24..b48821dd040 100644 --- a/maps/exodus/exodus-1_station.dmm +++ b/maps/exodus/exodus-1_station.dmm @@ -1353,49 +1353,6 @@ }, /turf/simulated/floor/tiled/dark, /area/security/armoury) -"acA" = ( -/obj/structure/table/rack, -/obj/structure/window/reinforced{ - dir = 1 - }, -/obj/structure/window/reinforced{ - dir = 4 - }, -/obj/machinery/light{ - dir = 1 - }, -/obj/machinery/door/window/brigdoor{ - dir = 2; - name = "Weapons locker"; - req_access = list(3) - }, -/obj/item/ammo_magazine/c45m/flash, -/obj/item/ammo_magazine/c45m/flash, -/obj/item/ammo_magazine/c45m/flash, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/c45m/rubber, -/obj/item/ammo_magazine/mc9mmt/rubber, -/obj/item/ammo_magazine/mc9mmt/rubber, -/obj/item/ammo_magazine/mc9mmt/rubber, -/obj/item/weapon/storage/box/beanbags, -/obj/item/weapon/storage/box/beanbags, -/obj/item/weapon/storage/box/flashshells, -/obj/item/weapon/storage/box/stunshells, -/obj/item/ammo_magazine/c45m/practice, -/obj/item/ammo_magazine/c45m/practice, -/obj/item/ammo_magazine/c45m/practice, -/obj/item/ammo_magazine/c45m/practice, -/obj/item/ammo_magazine/mc9mmt/practice, -/obj/item/ammo_magazine/mc9mmt/practice, -/obj/item/weapon/storage/box/practiceshells, -/obj/item/weapon/storage/box/practiceshells, -/obj/effect/floor_decal/industrial/outline/grey, -/turf/simulated/floor/tiled/dark, -/area/security/armoury) "acB" = ( /obj/structure/cable/green{ d1 = 1; @@ -2929,12 +2886,6 @@ "afs" = ( /turf/simulated/shuttle/wall, /area/shuttle/escape_pod3/station) -"aft" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/escape_pod3/station) "afu" = ( /obj/effect/decal/cleanable/blood/oil, /obj/effect/decal/remains/robot, @@ -3597,23 +3548,6 @@ /obj/item/trash/tastybread, /turf/simulated/floor/plating, /area/maintenance/security_starboard) -"agB" = ( -/turf/simulated/floor/plating, -/obj/structure/shuttle/engine/propulsion/burst{ - dir = 4 - }, -/turf/simulated/shuttle/wall{ - icon_state = "swall_f5"; - dir = 2 - }, -/area/shuttle/escape_pod3/station) -"agC" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/escape_pod3/station) "agD" = ( /obj/structure/table/rack, /obj/effect/decal/cleanable/cobweb, @@ -11156,12 +11090,6 @@ /obj/structure/grille, /turf/simulated/shuttle/plating, /area/shuttle/escape_pod1/station) -"atw" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/escape_pod1/station) "atx" = ( /turf/simulated/shuttle/wall, /area/shuttle/escape_pod2/station) @@ -11170,12 +11098,6 @@ /obj/structure/grille, /turf/simulated/shuttle/plating, /area/shuttle/escape_pod2/station) -"atz" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/escape_pod2/station) "atA" = ( /obj/structure/grille, /obj/structure/window/reinforced{ @@ -11387,11 +11309,6 @@ "aua" = ( /turf/simulated/wall/r_wall, /area/hallway/secondary/entry/fore) -"aub" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight" - }, -/area/shuttle/escape_pod1/station) "auc" = ( /obj/structure/bed/chair{ dir = 1 @@ -11411,11 +11328,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/escape_pod1/station) -"aud" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight" - }, -/area/shuttle/escape_pod2/station) "aue" = ( /obj/structure/bed/chair{ dir = 1 @@ -12138,14 +12050,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/escape_pod1/station) -"avK" = ( -/turf/simulated/floor/plating, -/obj/structure/shuttle/engine/propulsion/burst, -/turf/simulated/shuttle/wall{ - icon_state = "swall_f9"; - dir = 2 - }, -/area/shuttle/escape_pod1/station) "avL" = ( /obj/structure/shuttle/engine/propulsion/burst, /turf/simulated/shuttle/wall, @@ -12161,14 +12065,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/escape_pod2/station) -"avN" = ( -/turf/simulated/floor/plating, -/obj/structure/shuttle/engine/propulsion/burst, -/turf/simulated/shuttle/wall{ - icon_state = "swall_f9"; - dir = 2 - }, -/area/shuttle/escape_pod2/station) "avO" = ( /turf/simulated/floor/plating, /area/maintenance/arrivals) @@ -16301,12 +16197,6 @@ "aDq" = ( /turf/simulated/shuttle/wall, /area/shuttle/arrival/station) -"aDr" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 8 - }, -/area/shuttle/arrival/station) "aDs" = ( /obj/machinery/door/unpowered/shuttle, /turf/simulated/shuttle/floor, @@ -16315,25 +16205,6 @@ /obj/structure/window/shuttle, /turf/simulated/shuttle/plating, /area/shuttle/arrival/station) -"aDu" = ( -/obj/structure/window/shuttle{ - icon_state = "window8" - }, -/obj/structure/grille, -/turf/simulated/shuttle/plating, -/area/shuttle/arrival/station) -"aDv" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_t"; - dir = 1 - }, -/area/shuttle/arrival/station) -"aDw" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/arrival/station) "aDx" = ( /obj/effect/floor_decal/industrial/warning{ icon_state = "warning"; @@ -17137,12 +17008,6 @@ /obj/structure/window/reinforced, /turf/simulated/floor/tiled/dark, /area/maintenance/library) -"aEN" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_t"; - dir = 4 - }, -/area/shuttle/arrival/station) "aEO" = ( /obj/machinery/light{ dir = 8; @@ -17186,12 +17051,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/arrival/station) -"aEW" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_t"; - dir = 8 - }, -/area/shuttle/arrival/station) "aEX" = ( /obj/structure/shuttle/engine/propulsion{ icon_state = "burst_r"; @@ -17896,13 +17755,6 @@ /obj/machinery/atmospherics/pipe/simple/hidden/supply, /turf/simulated/floor/tiled/dark, /area/chapel/main) -"aGj" = ( -/turf/simulated/shuttle/floor, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/arrival/station) "aGk" = ( /obj/structure/bed/chair{ dir = 8 @@ -17913,11 +17765,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/arrival/station) -"aGl" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight" - }, -/area/shuttle/arrival/station) "aGm" = ( /obj/structure/bed/chair{ dir = 8 @@ -19674,12 +19521,6 @@ }, /turf/simulated/floor/tiled/dark, /area/chapel/main) -"aJx" = ( -/turf/simulated/shuttle/floor, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/arrival/station) "aJy" = ( /obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers{ dir = 8 @@ -20501,18 +20342,6 @@ }, /turf/simulated/floor/plating, /area/chapel/main) -"aLa" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 1 - }, -/area/shuttle/arrival/station) -"aLb" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_t" - }, -/area/shuttle/arrival/station) "aLc" = ( /obj/item/device/radio/intercom{ name = "Station Intercom (General)"; @@ -21362,13 +21191,6 @@ }, /turf/simulated/floor/plating, /area/chapel/main) -"aMG" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/arrival/station) "aMH" = ( /obj/effect/floor_decal/industrial/warning{ icon_state = "warning"; @@ -21769,14 +21591,6 @@ }, /turf/simulated/floor/tiled, /area/hallway/primary/central_one) -"aNw" = ( -/obj/machinery/firealarm{ - dir = 2; - pixel_x = -8; - pixel_y = 24 - }, -/turf/simulated/floor/tiled, -/area/hallway/primary/central_one) "aNx" = ( /obj/machinery/light{ dir = 1 @@ -23900,7 +23714,7 @@ pixel_x = 0 }, /obj/machinery/door/firedoor, -/turf/simulated/wall, +/turf/simulated/floor/plating, /area/hallway/secondary/entry/port) "aRr" = ( /obj/structure/grille, @@ -41496,23 +41310,11 @@ "bwJ" = ( /turf/simulated/shuttle/wall, /area/shuttle/research/station) -"bwK" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 4 - }, -/area/shuttle/research/station) "bwL" = ( /obj/structure/window/shuttle, /obj/structure/grille, /turf/simulated/shuttle/plating, /area/shuttle/research/station) -"bwM" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/research/station) "bwN" = ( /turf/template_noop, /area/shuttle/administration/station) @@ -42378,12 +42180,6 @@ /obj/random/coin, /turf/simulated/floor/plating, /area/storage/emergency) -"byo" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 1 - }, -/area/shuttle/research/station) "byp" = ( /obj/structure/closet/crate, /turf/simulated/shuttle/floor, @@ -45159,13 +44955,6 @@ }, /turf/simulated/shuttle/plating, /area/rnd/docking) -"bCW" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 1 - }, -/area/shuttle/research/station) "bCX" = ( /obj/machinery/door/airlock/external{ frequency = 1380; @@ -45177,13 +44966,6 @@ }, /turf/simulated/shuttle/floor, /area/shuttle/research/station) -"bCY" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/research/station) "bCZ" = ( /obj/effect/floor_decal/industrial/warning{ icon_state = "warning"; @@ -49845,23 +49627,11 @@ "bKQ" = ( /turf/simulated/shuttle/wall, /area/shuttle/mining/station) -"bKR" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 4 - }, -/area/shuttle/mining/station) "bKS" = ( /obj/structure/window/shuttle, /obj/structure/grille, /turf/simulated/shuttle/plating, /area/shuttle/mining/station) -"bKT" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/mining/station) "bKU" = ( /obj/machinery/computer/security/mining, /obj/item/device/radio/intercom{ @@ -50627,12 +50397,6 @@ }, /turf/simulated/floor/tiled/airless, /area/rnd/test_area) -"bMq" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 1 - }, -/area/shuttle/mining/station) "bMr" = ( /obj/machinery/light{ dir = 8; @@ -54567,24 +54331,10 @@ }, /turf/simulated/floor/tiled/airless, /area/rnd/test_area) -"bTv" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 1 - }, -/area/shuttle/mining/station) "bTw" = ( /obj/structure/shuttle/engine/propulsion/burst, /turf/template_noop, /area/shuttle/mining/station) -"bTx" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/mining/station) "bTy" = ( /obj/machinery/access_button{ command = "cycle_exterior"; @@ -56277,12 +56027,6 @@ "bWm" = ( /turf/simulated/shuttle/wall, /area/shuttle/escape_pod5/station) -"bWn" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 4 - }, -/area/shuttle/escape_pod5/station) "bWo" = ( /obj/structure/shuttle/engine/propulsion/burst{ dir = 4 @@ -57960,13 +57704,6 @@ }, /turf/simulated/floor/plating, /area/maintenance/research_starboard) -"bZg" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 1 - }, -/area/shuttle/escape_pod5/station) "bZh" = ( /obj/machinery/light/small, /turf/simulated/floor/plating, @@ -76665,19 +76402,6 @@ }, /turf/simulated/floor/plating, /area/engineering/engine_airlock) -"cGJ" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 4 - }, -/area/shuttle/constructionsite/station) -"cGK" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 4 - }, -/area/shuttle/constructionsite/station) "cGL" = ( /obj/machinery/door/airlock/external{ frequency = 1380; @@ -76705,12 +76429,6 @@ }, /turf/simulated/floor/plating, /area/shuttle/constructionsite/station) -"cGN" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c" - }, -/area/shuttle/constructionsite/station) "cGO" = ( /obj/structure/table/rack{ dir = 1 @@ -77047,12 +76765,6 @@ icon_state = "floor2" }, /area/shuttle/constructionsite/station) -"cHu" = ( -/turf/simulated/shuttle/wall{ - icon_state = "swall_straight"; - dir = 1 - }, -/area/shuttle/constructionsite/station) "cHv" = ( /obj/structure/sign/securearea{ desc = "A warning sign which reads 'KEEP CLEAR OF DOCKING AREA'."; @@ -77746,20 +77458,6 @@ /obj/machinery/atmospherics/binary/pump, /turf/simulated/floor/plating, /area/engineering/engine_room) -"cIJ" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 1 - }, -/area/shuttle/constructionsite/station) -"cIK" = ( -/turf/template_noop, -/turf/simulated/shuttle/wall{ - icon_state = "swall_c"; - dir = 8 - }, -/area/shuttle/constructionsite/station) "cIL" = ( /obj/structure/lattice, /obj/machinery/atmospherics/pipe/simple/heat_exchanging,