mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-21 20:27:42 +01:00
[MIRROR] Check Access List Mapper Verb (#12647)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
co-authored by
Will
Kashargul
parent
646a9a1030
commit
74f6f2f08d
@@ -17,3 +17,34 @@
|
||||
// continue
|
||||
|
||||
TEST_FAIL(log_entry)
|
||||
|
||||
/* Should probably be done as a linter thing instead
|
||||
/// Checks all machines for legal access numbers
|
||||
/datum/unit_test/all_access_id_must_have_existing_datums
|
||||
|
||||
/datum/unit_test/all_access_id_must_have_existing_datums/Run()
|
||||
var/failed = FALSE
|
||||
var/list/access_datums = SSaccess.get_all_access_datums_by_id()
|
||||
|
||||
for(var/obj/machinery/thing in world)
|
||||
failed += validate_list(thing.req_access, thing, "req_access")
|
||||
failed += validate_list(thing.req_one_access, thing, "req_one_access")
|
||||
if(failed)
|
||||
TEST_FAIL("Machinery had an illegal access id.")
|
||||
|
||||
/datum/unit_test/proc/validate_list(var/list/access_list, var/obj/machinery/thing, name_list)
|
||||
if(!access_list)
|
||||
return FALSE // null is legal
|
||||
|
||||
if(!islist(access_list))
|
||||
TEST_NOTICE(src, "Access - [thing] ([thing.x].[thing.y].[thing.z]) had a [name_list] that was not a list or null.")
|
||||
return TRUE // Was something other than null or a list... illegal
|
||||
|
||||
var/failed = FALSE
|
||||
for(var/access in access_list)
|
||||
if(!SSaccess.get_access_by_id(access))
|
||||
TEST_NOTICE(src, "Access - [thing] ([thing.x].[thing.y].[thing.z]) had a [name_list] with a non-existant id [access].")
|
||||
failed = TRUE // has a non-existant id, illegal
|
||||
|
||||
return failed
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user