code quality

This commit is contained in:
Letter N
2020-12-29 11:12:56 +08:00
parent 51143f89e5
commit f28363ae56
65 changed files with 950 additions and 347 deletions
+27 -2
View File
@@ -27,6 +27,33 @@
TEST_ASSERT(!patient.has_trauma_type(), "Patient kept their brain trauma after brain surgery")
TEST_ASSERT(patient.getOrganLoss(ORGAN_SLOT_BRAIN) < 20, "Patient did not heal their brain damage after brain surgery")
/datum/unit_test/head_transplant/Run()
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/alice = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/bob = allocate(/mob/living/carbon/human)
alice.fully_replace_character_name(null, "Alice")
bob.fully_replace_character_name(null, "Bob")
var/obj/item/bodypart/head/alices_head = alice.get_bodypart(BODY_ZONE_HEAD)
alices_head.drop_limb()
var/obj/item/bodypart/head/bobs_head = bob.get_bodypart(BODY_ZONE_HEAD)
bobs_head.drop_limb()
TEST_ASSERT_EQUAL(alice.get_bodypart(BODY_ZONE_HEAD), null, "Alice still has a head after dismemberment")
TEST_ASSERT_EQUAL(alice.get_visible_name(), "Unknown", "Alice's head was dismembered, but they are not Unknown")
TEST_ASSERT_EQUAL(bobs_head.real_name, "Bob", "Bob's head does not remember that it is from Bob")
// Put Bob's head onto Alice's body
var/datum/surgery_step/add_prosthetic/add_prosthetic = new
user.put_in_active_hand(bobs_head)
add_prosthetic.success(user, alice, BODY_ZONE_HEAD, bobs_head)
TEST_ASSERT(!isnull(alice.get_bodypart(BODY_ZONE_HEAD)), "Alice has no head after prosthetic replacement")
TEST_ASSERT_EQUAL(alice.get_visible_name(), "Bob", "Bob's head was transplanted onto Alice's body, but their name is not Bob")
/datum/unit_test/multiple_surgeries/Run()
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/patient_zero = allocate(/mob/living/carbon/human)
@@ -41,8 +68,6 @@
TEST_ASSERT(surgery_for_zero.step_in_progress, "Surgery on patient zero was not initiated")
var/datum/surgery/organ_manipulation/surgery_for_one = new
sleep(0.2) // if we don't have this, then the next surgery step can start *before* the previous one does, which is no good
// Without waiting for the incision to complete, try to start a new surgery
TEST_ASSERT(!surgery_step.initiate(user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one), "Was allowed to start a second surgery without the rod of asclepius")