mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 17:07:53 +01:00
Stairs unit test (#18465)
* sdf * fsaddf * sadf * sadf * expanded documentation on stairs
This commit is contained in:
@@ -341,5 +341,36 @@
|
||||
|
||||
return 1
|
||||
|
||||
/datum/unit_test/map_test/stairs_mapped
|
||||
name = "MAP: Stairs"
|
||||
|
||||
/datum/unit_test/map_test/stairs_mapped/start_test()
|
||||
var/test_status = UNIT_TEST_PASSED
|
||||
|
||||
//Loop through all the stairs in the map
|
||||
for(var/obj/structure/stairs/a_stair in world)
|
||||
|
||||
//See if there is any other stair in the same turf
|
||||
for(var/obj/structure/stairs/possibly_another_stair in get_turf(a_stair))
|
||||
if(a_stair != possibly_another_stair)
|
||||
test_status = TEST_FAIL("Duplicate stairs located in [a_stair.x]X - [a_stair.y]Y - [a_stair.z]Z! \
|
||||
Only one stair should exist inside a turf.")
|
||||
|
||||
if(is_abstract(a_stair))
|
||||
test_status = TEST_FAIL("The stairs located in [a_stair.x]X - [a_stair.y]Y - [a_stair.z]Z are of an abstract type ([a_stair.type]) that should never be mapped!")
|
||||
|
||||
//Check that noone changed the bounds in the map editor
|
||||
if(a_stair.bound_height != initial(a_stair.bound_height) || a_stair.bound_width != initial(a_stair.bound_width) || \
|
||||
a_stair.bound_x != initial(a_stair.bound_x) || a_stair.bound_y != initial(a_stair.bound_y))
|
||||
|
||||
test_status = TEST_FAIL("The stairs at [a_stair.x]X - [a_stair.y]Y - [a_stair.z]Z have map-defined bounds!")
|
||||
|
||||
if(test_status == UNIT_TEST_PASSED)
|
||||
TEST_PASS("All the mapped stairs are valid.")
|
||||
else
|
||||
TEST_FAIL("Some mapped stairs are invalid!")
|
||||
|
||||
return test_status
|
||||
|
||||
#undef SUCCESS
|
||||
#undef FAILURE
|
||||
|
||||
@@ -129,7 +129,7 @@ SUBSYSTEM_DEF(unit_tests)
|
||||
for(var/thing in subtypesof(/datum/unit_test) - typecacheof(SSatlas.current_map.excluded_test_types))
|
||||
var/datum/unit_test/D = new thing
|
||||
|
||||
if(findtext(D.name, "template"))
|
||||
if(findtext(D.name, "template") || is_abstract(D))
|
||||
qdel(D)
|
||||
continue
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/datum/unit_test/stairs_type
|
||||
name = "Test stairs types"
|
||||
groups = list("generic")
|
||||
priority = 1
|
||||
|
||||
/datum/unit_test/stairs_type/start_test()
|
||||
var/test_status = UNIT_TEST_PASSED
|
||||
|
||||
for(var/obj/structure/stairs/stair_type as anything in subtypesof(/obj/structure/stairs))
|
||||
//No need for abstract stairs to respect this really
|
||||
if(is_abstract(stair_type))
|
||||
continue
|
||||
|
||||
//The bounds have to be set based on the direction of the stairs, that must be set in code for sanity
|
||||
switch(initial(stair_type.dir))
|
||||
|
||||
if(NORTH)
|
||||
if((initial(stair_type.bound_height) != 64) || (initial(stair_type.bound_y) != -32))
|
||||
test_status = TEST_FAIL("The stairs type [stair_type.type] does not have the bounds set correctly!")
|
||||
|
||||
if(SOUTH)
|
||||
if((initial(stair_type.bound_height) != 64) || (initial(stair_type.bound_y) != 0))
|
||||
test_status = TEST_FAIL("The stairs type [stair_type.type] does not have the bounds set correctly!")
|
||||
|
||||
if(EAST)
|
||||
if((initial(stair_type.bound_width) != 64) || (initial(stair_type.bound_x) != -32))
|
||||
test_status = TEST_FAIL("The stairs type [stair_type.type] does not have the bounds set correctly!")
|
||||
|
||||
if(WEST)
|
||||
if((initial(stair_type.bound_width) != 64) || (initial(stair_type.bound_x) != 0))
|
||||
test_status = TEST_FAIL("The stairs type [stair_type.type] does not have the bounds set correctly!")
|
||||
|
||||
return test_status
|
||||
@@ -42,6 +42,7 @@ var/ascii_reset = "[ascii_esc]\[0m"
|
||||
// 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.
|
||||
|
||||
/datum/unit_test
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user