mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 13:30:42 +01:00
GetSortedAreas safety and area unit test fixes (#22851)
Fixes a helper proc that, among other things, had quietly broken all our area building unit tests. Fixes every single goddamn area that had been mapped wrong because the unit tests weren't running. changes: - code_imp: "Updates map_path var for mapping unit tests to be a list instead of a var, allowing for opting-in of unit tests on by-map basis." - code_imp: "Fire alarm directionality map test updated for (almost) all directional wall-mounted objects, with only sccv_horizon map currently opted-in." - bugfix: "Adds extra safety for GLOB.SortedAreas having entries removed but not later re-generated." - bugfix: "Fixes all the incorrectly mapped areas on the Horizon exposed by newly-run unit tests." - imageadd: "Adds currently unused map_helper sprites for airlocks- prep for future work."
This commit is contained in:
@@ -120,6 +120,6 @@
|
||||
|
||||
/// Returns a sorted version of GLOB.areas, by name
|
||||
/proc/get_sorted_areas()
|
||||
if(!GLOB.sortedAreas)
|
||||
if(!GLOB.sortedAreas || (length(GLOB.sortedAreas) < length(GLOB.areas)))
|
||||
GLOB.sortedAreas = sortTim(GLOB.areas.Copy(), /proc/cmp_name_asc)
|
||||
return GLOB.sortedAreas
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
if (!SSatlas.current_map)
|
||||
return
|
||||
|
||||
// This is formatted strangely because it fails the indentation test if it's formatted properly.
|
||||
// ¯\_(ツ)_/¯
|
||||
var/list/exempt_areas = typecacheof(SSatlas.current_map.ut_environ_exempt_areas)
|
||||
var/list/exempt_from_atmos = typecacheof(SSatlas.current_map.ut_atmos_exempt_areas)
|
||||
var/list/exempt_from_apc = typecacheof(SSatlas.current_map.ut_apc_exempt_areas)
|
||||
@@ -450,43 +448,50 @@
|
||||
|
||||
return test_status
|
||||
|
||||
// At present, only fire alarms have NSEW as immediate children, whereas APCs and Air Alarms also have them as sub-children.
|
||||
// In the future, areas should have additional vars to populate APC data automatically, allowing them to have directional
|
||||
// immediate children too for mapping testing.
|
||||
/datum/unit_test/map_test/no_panel_dir_var_edits
|
||||
name = "MAP: Check for Fire Alarm dir var edits"
|
||||
// Checks mapped wall-mounted objects with direction presets.
|
||||
/datum/unit_test/map_test/no_directional_subtype_dir_var_edits
|
||||
name = "MAP: Check for directional subtype dir var edits"
|
||||
// Right now, this only runs on the Horizon. ALL NEW MAPS should opt-in to this unit test.
|
||||
// Old maps are REQUIRED to be opted-in when they're touched for the first time since this unit test was added.
|
||||
map_path = list("sccv_horizon")
|
||||
|
||||
/datum/unit_test/map_test/no_panel_dir_var_edits/start_test()
|
||||
/datum/unit_test/map_test/no_directional_subtype_dir_var_edits/start_test()
|
||||
var/test_status = UNIT_TEST_PASSED
|
||||
var/checks = 0
|
||||
var/failed_checks = 0
|
||||
var/firealarm_increment
|
||||
var/turf/T
|
||||
var/list/checked_types = typecacheof(list(
|
||||
/obj/structure/machinery/alarm,
|
||||
/obj/structure/machinery/power/apc,
|
||||
/obj/structure/machinery/firealarm,
|
||||
// save this for nbt2. fuck me. i don't have the strength for this rn. no one does.
|
||||
// /obj/structure/machinery/light_switch,
|
||||
/obj/structure/extinguisher_cabinet,
|
||||
/obj/structure/fireaxecabinet,
|
||||
/obj/structure/closet/walllocker,
|
||||
/obj/item/radio/intercom,
|
||||
))
|
||||
|
||||
for(var/obj/structure/machinery/firealarm/F in world)
|
||||
T = get_turf(F)
|
||||
firealarm_increment = 0
|
||||
if(istype(F, /obj/structure/machinery/firealarm/north))
|
||||
if(F.dir != NORTH)
|
||||
firealarm_increment++
|
||||
if(istype(F, /obj/structure/machinery/firealarm/south))
|
||||
if(F.dir != SOUTH)
|
||||
firealarm_increment++
|
||||
if(istype(F, /obj/structure/machinery/firealarm/east))
|
||||
if(F.dir != EAST)
|
||||
firealarm_increment++
|
||||
if(istype(F, /obj/structure/machinery/firealarm/west))
|
||||
if(F.dir != WEST)
|
||||
firealarm_increment++
|
||||
for(var/obj/O in world)
|
||||
if(!is_type_in_typecache(O, checked_types))
|
||||
continue
|
||||
|
||||
var/turf/object_turf = O.loc
|
||||
if(istype(object_turf))
|
||||
if(!is_station_level(object_turf.z))
|
||||
continue
|
||||
|
||||
var/obj/obj_type = O.type
|
||||
var/expected_dir = initial(obj_type.dir)
|
||||
checks++
|
||||
if(firealarm_increment > 1)
|
||||
|
||||
if(O.dir != expected_dir)
|
||||
failed_checks++
|
||||
TEST_FAIL("Manually var edited [F] at ([F.x],[F.y],[F.z]) in [T.loc].")
|
||||
TEST_FAIL("Mapped [O] ([O.type]) at ([O.x],[O.y],[O.z]) in [get_area(O)] has dir [dir2text(O.dir)], but its type's initial dir is [dir2text(expected_dir)]. Use the matching directional subtype instead of editing dir.")
|
||||
|
||||
if(failed_checks)
|
||||
TEST_FAIL("\[[failed_checks] / [checks]\] Some fire alarms had their dir var manually edited instead of using a preset variant. Please also check new APCs and air alarms in the area.")
|
||||
TEST_FAIL("\[[failed_checks] / [checks]\] Checked objects had their dir var manually edited.")
|
||||
else
|
||||
TEST_PASS("All \[[checks]\] fire alarms mapped properly.")
|
||||
TEST_PASS("All \[[checks]\] checked objects are mapped with their initial dir values.")
|
||||
|
||||
return test_status
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ SUBSYSTEM_DEF(unit_tests)
|
||||
|
||||
TEST_GROUP_OPEN("[test.name]")
|
||||
|
||||
if (test.map_path && SSatlas.current_map && SSatlas.current_map.path != test.map_path)
|
||||
if (length(test.map_path) && SSatlas.current_map && !(SSatlas.current_map.path in test.map_path))
|
||||
test.pass(TEST_OUTPUT_GREEN("Check Disabled: This test is not allowed to run on this map."), __FILE__, __LINE__)
|
||||
TEST_GROUP_CLOSE("[test.name]")
|
||||
if (MC_TICK_CHECK)
|
||||
|
||||
@@ -30,25 +30,29 @@ GLOBAL_VAR_INIT(unit_tests_failures, 0)
|
||||
GLOBAL_VAR_INIT(total_unit_tests, 0)
|
||||
|
||||
|
||||
// We list these here so we can remove them from the for loop running this.
|
||||
// Templates aren't intended to be ran but just serve as a way to create child objects of it with inheritable tests for quick test creation.
|
||||
|
||||
/// We list these here so we can remove them from the for loop running this.
|
||||
/// Templates aren't intended to be ran but just serve as a way to create child objects of it with inheritable tests for quick test creation.
|
||||
ABSTRACT_TYPE(/datum/unit_test)
|
||||
var/name = "template - should not be ran."
|
||||
var/disabled = 0 // If we want to keep a unit test in the codebase but not run it for some reason.
|
||||
var/async = 0 // If the check can be left to do it's own thing, you must define a check_result() proc if you use this.
|
||||
var/reported = 0 // If it's reported a success or failure. Any tests that have not are assumed to be failures.
|
||||
var/why_disabled = "No reason set." // If we disable a unit test we will display why so it reminds us to check back on it later.
|
||||
var/map_path // This should be the same as the path var on /datum/map - The unit test will only run for that map
|
||||
/// If we want to keep a unit test in the codebase but not run it for some reason.
|
||||
var/disabled = 0
|
||||
/// If the check can be left to do its own thing, you must define a check_result() proc if you use this.
|
||||
var/async = 0
|
||||
/// If it's reported a success or failure. Any tests that have not are assumed to be failures.
|
||||
var/reported = 0
|
||||
/// If we disable a unit test we will display why so it reminds us to check back on it later.
|
||||
var/why_disabled = "No reason set."
|
||||
/// These should be the same as the path var on /datum/map - The unit test will only run for those maps
|
||||
var/list/map_path
|
||||
|
||||
///A list of strings, each of which represents a group which this UT belongs to, the UT pods will only run UTs that are in their list
|
||||
/// A list of strings, each of which represents a group which this UT belongs to, the UT pods will only run UTs that are in their list
|
||||
var/list/groups = list()
|
||||
|
||||
///The priority of the test, the larger it is the later it fires
|
||||
/// The priority of the test, the larger it is the later it fires
|
||||
var/priority = 1000
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Log levels used to prettify correctly, only defined in this file (aka undef'd at the end)
|
||||
* Build unit test messages as per https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions, or for console output
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
author: Batrachophrenoboocosmomachia
|
||||
delete-after: True
|
||||
changes:
|
||||
- code_imp: "Updates map_path var for mapping unit tests to be a list instead of a var, allowing for opting-in of unit tests on by-map basis."
|
||||
- code_imp: "Updates fire alarm directionality map test for (almost) all directional wall-mounted objects, with only sccv_horizon map currently opted-in."
|
||||
- bugfix: "Adds extra safety for GLOB.SortedAreas having entries removed but not later re-generated."
|
||||
- bugfix: "Fixes all the incorrectly mapped areas on the Horizon exposed by newly-run unit tests."
|
||||
- imageadd: "Adds currently unused map_helper sprites for airlocks- prep for future work."
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 30 KiB |
@@ -1,6 +1,6 @@
|
||||
/datum/map
|
||||
var/list/ut_environ_exempt_areas = list(/area/space)
|
||||
var/list/ut_apc_exempt_areas = list()
|
||||
var/list/ut_atmos_exempt_areas = list()
|
||||
var/list/ut_fire_exempt_areas = list()
|
||||
var/list/ut_environ_exempt_areas = list(/area/space,/area/template_noop)
|
||||
var/list/ut_apc_exempt_areas = list(/area/space,/area/template_noop)
|
||||
var/list/ut_atmos_exempt_areas = list(/area/space,/area/template_noop)
|
||||
var/list/ut_fire_exempt_areas = list(/area/space,/area/template_noop)
|
||||
var/list/excluded_test_types = list()
|
||||
|
||||
@@ -10,38 +10,53 @@
|
||||
/area/supply/dock,
|
||||
/area/turbolift,
|
||||
/area/mine,
|
||||
/area/horizon/exterior
|
||||
/area/horizon/exterior,
|
||||
/area/template_noop,
|
||||
/area/horizon/shuttle/escape_pod
|
||||
)
|
||||
|
||||
ut_apc_exempt_areas = list()
|
||||
ut_apc_exempt_areas = list(
|
||||
// IF YOU ARE GOING TO ADD MORE EXEMPT AREAS, HAVE A GOOD REASON AND MOVE THIS MESSAGE DOWN A LINE.
|
||||
)
|
||||
|
||||
ut_atmos_exempt_areas = list(
|
||||
/area/horizon/maintenance,
|
||||
/area/horizon/engineering/atmos/storage,
|
||||
/area/horizon/rnd/server,
|
||||
/area/horizon/tcommsat/chamber,
|
||||
/area/horizon/command/bridge/aibunker,
|
||||
/area/horizon/medical/cryo,
|
||||
/area/horizon/medical/surgery/storage,
|
||||
/area/horizon/ai,
|
||||
/area/horizon/engineering/reactor/indra/smes,
|
||||
/area/horizon/rnd/xenoarch/isolation_a,
|
||||
/area/horizon/rnd/xenoarch/isolation_b,
|
||||
/area/horizon/rnd/xenoarch/isolation_c
|
||||
/area/horizon/maintenance, // It's the maints, mate
|
||||
/area/horizon/engineering/atmos/storage, // Quasi-maints
|
||||
/area/horizon/engineering/atmos/storage_maintenance, // Quasi-maints
|
||||
/area/horizon/rnd/server, // Fancy local temp control
|
||||
/area/horizon/tcommsat/chamber, // Fancy local temp control
|
||||
/area/horizon/command/bridge/aibunker, // Fancy local temp control
|
||||
/area/horizon/medical/cryo, // Quasi-maints
|
||||
/area/horizon/medical/surgery/storage, //
|
||||
/area/horizon/ai, // Fancy local temp control
|
||||
/area/horizon/rnd/xenoarch/isolation_a, // Science bullshit
|
||||
/area/horizon/rnd/xenoarch/isolation_b, // Science bullshit
|
||||
/area/horizon/rnd/xenoarch/isolation_c, // Science bullshit
|
||||
/area/horizon/shuttle/escape_pod, // You're dead anyway if something goes wrong
|
||||
/area/horizon/operations/package_conveyors, // It's less maints+ and more maints-
|
||||
/area/horizon/shuttle/canary // Where the fuck are you gonna put them
|
||||
// IF YOU ARE GOING TO ADD MORE EXEMPT AREAS, HAVE A GOOD REASON AND MOVE THIS MESSAGE DOWN A LINE.
|
||||
)
|
||||
|
||||
ut_fire_exempt_areas = list(
|
||||
/area/horizon/maintenance,
|
||||
/area/horizon/command/bridge/aibunker,
|
||||
/area/horizon/medical/cryo,
|
||||
/area/horizon/crew/washroom/deck_3,
|
||||
/area/horizon/rnd/xenoarch/isolation_a,
|
||||
/area/horizon/rnd/xenoarch/isolation_b,
|
||||
/area/horizon/rnd/xenoarch/isolation_c
|
||||
/area/horizon/maintenance, // It's the maints, mate
|
||||
/area/horizon/command/bridge/aibunker, // Design
|
||||
/area/horizon/medical/cryo, // Quasi-maints
|
||||
/area/horizon/engineering/atmos/storage, // Quasi-maints
|
||||
/area/horizon/engineering/atmos/storage_maintenance, // Quasi-maints
|
||||
/area/horizon/rnd/xenoarch/isolation_a, // Science bullshit
|
||||
/area/horizon/rnd/xenoarch/isolation_b, // Science bullshit
|
||||
/area/horizon/rnd/xenoarch/isolation_c, // Science bullshit
|
||||
/area/horizon/shuttle/escape_pod, // You're dead anyway if something goes wrong
|
||||
/area/horizon/operations/package_conveyors, // It's less maints+ and more maints-
|
||||
/area/horizon/stairwell/engineering/deck_1, // Alarm on deck 2
|
||||
/area/horizon/stairwell/starboard/deck_1, // Alarm on deck 2
|
||||
/area/horizon/stairwell/starboard/deck_3 // Alarm on deck 2
|
||||
// IF YOU ARE GOING TO ADD MORE EXEMPT AREAS, HAVE A GOOD REASON AND MOVE THIS MESSAGE DOWN A LINE.
|
||||
)
|
||||
|
||||
/datum/unit_test/zas_area_test/sccv_horizon
|
||||
map_path = "sccv_horizon"
|
||||
map_path = list("sccv_horizon")
|
||||
|
||||
/datum/unit_test/zas_area_test/sccv_horizon/storage
|
||||
name = "ZAS: Operations Bay"
|
||||
|
||||
+3448
-3399
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user