Fixes incapacitating sleep test failure, general test touch ups. (#55196)

Fixes the random incapacitating sleep test failure
Tests now provide the option to use a custom turf, by default uses plasteel tiles instead of space
Tests now reserve turf instead of just using a corner in CentCom (which had unaccounted for tiles)
This commit is contained in:
Jared-Fogle
2020-11-28 02:36:02 -08:00
committed by GitHub
parent 5d7286b307
commit bee63ff37a
5 changed files with 27 additions and 11 deletions
@@ -3,7 +3,6 @@
var/obj/machinery/freezer = allocate(/obj/machinery/atmospherics/components/unary/thermomachine/freezer)
var/turf/freezer_location = freezer.loc
freezer_location.ChangeTurf(/turf/open/floor/plasteel)
freezer.deconstruct()
// Check that the components are created
@@ -11,6 +11,9 @@
target.health = 80
/datum/unit_test/reagent_mob_expose/Run()
// Life() is handled just by tests
SSmobs.pause()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/obj/item/reagent_containers/dropper/dropper = allocate(/obj/item/reagent_containers/dropper)
var/obj/item/reagent_containers/food/drinks/drink = allocate(/obj/item/reagent_containers/food/drinks/bottle)
@@ -23,7 +26,7 @@
drink.attack(human, human)
TEST_ASSERT_EQUAL(human.fire_stacks, 1, "Human does not have fire stacks after taking phlogiston")
human.Life()
TEST_ASSERT_EQUAL(human.fire_stacks, 2, "Human fire stacks did not increase after life tick")
TEST_ASSERT(human.fire_stacks > 1, "Human fire stacks did not increase after life tick")
// TOUCH
dropper.reagents.add_reagent(/datum/reagent/water, 1)
@@ -50,3 +53,6 @@
syringe.mode = SYRINGE_INJECT
syringe.afterattack(human, human, TRUE)
TEST_ASSERT_EQUAL(human.health, 80, "Human health did not update after injection from syringe")
/datum/unit_test/reagent_mob_expose/Destroy()
SSmobs.ignite()
+16 -3
View File
@@ -19,20 +19,33 @@ GLOBAL_VAR(test_log)
//Bit of metadata for the future maybe
var/list/procs_tested
//usable vars
/// The bottom left turf of the testing zone
var/turf/run_loc_bottom_left
/// The top right turf of the testing zone
var/turf/run_loc_top_right
/// The type of turf to allocate for the testing zone
var/test_turf_type = /turf/open/floor/plasteel
//internal shit
var/focus = FALSE
var/succeeded = TRUE
var/list/allocated
var/list/fail_reasons
var/static/datum/turf_reservation/turf_reservation
/datum/unit_test/New()
if (isnull(turf_reservation))
turf_reservation = SSmapping.RequestBlockReservation(5, 5)
for (var/turf/reserved_turf in turf_reservation.reserved_turfs)
reserved_turf.ChangeTurf(test_turf_type)
allocated = new
run_loc_bottom_left = locate(1, 1, 1)
run_loc_top_right = locate(5, 5, 1)
run_loc_bottom_left = locate(turf_reservation.bottom_left_coords[1], turf_reservation.bottom_left_coords[2], turf_reservation.bottom_left_coords[3])
run_loc_top_right = locate(turf_reservation.top_right_coords[1], turf_reservation.top_right_coords[2], turf_reservation.top_right_coords[3])
/datum/unit_test/Destroy()
//clear the test area