Unit Tests use a consistent human subtype (#71515)

title
This commit is contained in:
Zephyr
2022-11-26 20:36:20 +01:00
committed by GitHub
parent 6120914f65
commit 1900eb9484
45 changed files with 125 additions and 101 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ You can find more information about all of these from their respective doc comme
`/datum/unit_test` - The base for all tests to be ran. Subtypes must override `Run()`. `New()` and `Destroy()` can be used for setup and teardown. To fail, use `TEST_FAIL(reason)`.
`/datum/unit_test/proc/allocate(type, ...)` - Allocates an instance of the provided type with the given arguments. Is automatically destroyed when the test is over. Commonly seen in the form of `var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)`.
`/datum/unit_test/proc/allocate(type, ...)` - Allocates an instance of the provided type with the given arguments. Is automatically destroyed when the test is over. Commonly seen in the form of `var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)`.
`TEST_FAIL(reason)` - Marks a failure at this location, but does not stop the test.
+2 -2
View File
@@ -2,7 +2,7 @@
/datum/unit_test/ablative_hood_hud
/datum/unit_test/ablative_hood_hud/Run()
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent)
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
person.equip_to_slot(coat, ITEM_SLOT_OCLOTHING)
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person already had a sechud before trying to equip the ablative hood.")
@@ -15,7 +15,7 @@
/datum/unit_test/ablative_hood_hud_with_helmet
/datum/unit_test/ablative_hood_hud_with_helmet/Run()
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent)
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
var/obj/item/clothing/head/helmet/hat = allocate(/obj/item/clothing/head/helmet)
person.equip_to_slot(coat, ITEM_SLOT_OCLOTHING)
+1 -1
View File
@@ -4,7 +4,7 @@
/datum/unit_test/anonymous_themes/Run()
GLOB.current_anonymous_theme = new /datum/anonymous_theme
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/datum/client_interface/client = new
human.mock_client = client
+1 -1
View File
@@ -3,7 +3,7 @@
/datum/unit_test/bloody_footprints
/datum/unit_test/bloody_footprints/Run()
var/mob/living/carbon/human/blood_master = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/blood_master = allocate(/mob/living/carbon/human/consistent)
var/obj/item/clothing/shoes/holds_blood = allocate(/obj/item/clothing/shoes)
blood_master.equip_to_slot_if_possible(holds_blood, ITEM_SLOT_FEET)
+1 -1
View File
@@ -4,7 +4,7 @@
/datum/unit_test/breath_sanity
/datum/unit_test/breath_sanity/Run()
var/mob/living/carbon/human/lab_rat = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/lab_rat = allocate(/mob/living/carbon/human/consistent)
var/obj/item/clothing/mask/breath/tube = allocate(/obj/item/clothing/mask/breath)
var/obj/item/tank/internals/emergency_oxygen/source = allocate(/obj/item/tank/internals/emergency_oxygen)
+10 -10
View File
@@ -1,6 +1,6 @@
/datum/unit_test/harm_punch/Run()
var/mob/living/carbon/human/puncher = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/puncher = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
// Avoid all randomness in tests
ADD_TRAIT(puncher, TRAIT_PERFECT_ATTACKER, INNATE_TRAIT)
@@ -11,8 +11,8 @@
TEST_ASSERT(victim.getBruteLoss() > 0, "Victim took no brute damage after being punched")
/datum/unit_test/harm_melee/Run()
var/mob/living/carbon/human/tider = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/tider = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/obj/item/storage/toolbox/toolbox = allocate(/obj/item/storage/toolbox)
tider.put_in_active_hand(toolbox, forced = TRUE)
@@ -22,8 +22,8 @@
TEST_ASSERT(victim.getBruteLoss() > 0, "Victim took no brute damage after being hit by a toolbox")
/datum/unit_test/harm_different_damage/Run()
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/obj/item/weldingtool/welding_tool = allocate(/obj/item/weldingtool)
attacker.put_in_active_hand(welding_tool, forced = TRUE)
@@ -53,8 +53,8 @@
pre_attack_hit = TRUE
/datum/unit_test/attack_chain/Run()
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/obj/item/storage/toolbox/toolbox = allocate(/obj/item/storage/toolbox)
RegisterSignal(toolbox, COMSIG_ITEM_PRE_ATTACK, PROC_REF(pre_attack_hit))
@@ -70,8 +70,8 @@
TEST_ASSERT(post_attack_hit, "Post-attack signal was not fired")
/datum/unit_test/disarm/Run()
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/obj/item/storage/toolbox/toolbox = allocate(/obj/item/storage/toolbox)
victim.put_in_active_hand(toolbox, forced = TRUE)
+1 -1
View File
@@ -1,6 +1,6 @@
// Checks that the confusion symptom correctly gives, and removes, confusion
/datum/unit_test/confusion_symptom/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
var/datum/disease/advance/confusion/disease = allocate(/datum/disease/advance/confusion)
var/datum/symptom/confusion/confusion = disease.symptoms[1]
disease.processing = TRUE
+1 -1
View File
@@ -2,7 +2,7 @@
var/emotes_used = 0
/datum/unit_test/emoting/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
RegisterSignal(human, COMSIG_MOB_EMOTE, PROC_REF(on_emote_used))
human.say("*shrug")
+1 -1
View File
@@ -14,7 +14,7 @@
// Gotta create ourselves a rune and a user to start.
var/obj/effect/heretic_rune/big/our_rune = allocate(/obj/effect/heretic_rune/big)
var/mob/living/carbon/human/our_heretic = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/our_heretic = allocate(/mob/living/carbon/human/consistent)
// -- Note for the human dummy we create:
// The user does not actually NEED a heretic antag datum for the type of rituals we're testing,
// so we don't give them one here. The heretic antag datum has side effects when applied,
@@ -2,7 +2,7 @@
/datum/unit_test/human_through_recycler
/datum/unit_test/human_through_recycler/Run()
var/mob/living/carbon/human/assistant = allocate(/mob/living/carbon/human, run_loc_floor_bottom_left) // we should be in the bottom_left by default, but let's be sooper dooper sure :)
var/mob/living/carbon/human/assistant = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) // we should be in the bottom_left by default, but let's be sooper dooper sure :)
var/obj/machinery/recycler/chewer = allocate(/obj/machinery/recycler/deathtrap, get_step(run_loc_floor_bottom_left, EAST)) //already existing subtype that has emagged set to TRUE, so it shall CHEW. Put it directly right to the assistant to mimick a player entering the recycler.
assistant.equipOutfit(/datum/outfit/job/assistant/consistent) // consistent assistant juuuust in case
var/turf/open/stage = get_turf(chewer)
@@ -4,7 +4,7 @@
/datum/unit_test/hydroponics_extractor_storage/Run()
var/obj/machinery/seed_extractor/extractor = allocate(/obj/machinery/seed_extractor)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
var/obj/item/storage/bag/plants/storage = allocate(/obj/item/storage/bag/plants)
@@ -25,7 +25,7 @@
var/obj/item/seeds/planted_not_food_seed = allocate(/obj/item/seeds/sunflower) //grown inedible
var/obj/item/seeds/planted_densified_seed = allocate(/obj/item/seeds/redbeet) //grown + densified chemicals
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
hydroponics_tray.forceMove(run_loc_floor_bottom_left)
human.forceMove(locate((run_loc_floor_bottom_left.x + 1), run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z))
@@ -3,8 +3,8 @@
/datum/unit_test/knockoff_component
/datum/unit_test/knockoff_component/Run()
var/mob/living/carbon/human/wears_the_glasses = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/shoves_the_guy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/wears_the_glasses = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/shoves_the_guy = allocate(/mob/living/carbon/human/consistent)
// No pre-existing items have a 100% chance of being knocked off,
// so we'll just apply it to a relatively generic item (glasses)
+1 -1
View File
@@ -15,7 +15,7 @@
var/expected_laser_armor = demo_mech.armor.getRating(LASER)
var/expected_bullet_armor = demo_mech.armor.getRating(BULLET)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
dummy.forceMove(locate(run_loc_floor_bottom_left.x + 1, run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z))
// The dummy needs to be targeting an arm. Left is chosen here arbitrarily.
dummy.zone_selected = BODY_ZONE_L_ARM
+2 -2
View File
@@ -1,6 +1,6 @@
/// This test is used to make sure a flesh-and-bone base human can suffer all the types of wounds, and that suffering more severe wounds removes and replaces the lesser wound. Also tests that [/mob/living/carbon/proc/fully_heal] removes all wounds
/datum/unit_test/test_human_base/Run()
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
/// the limbs have no wound resistance like the chest and head do, so let's go with the r_arm
var/obj/item/bodypart/tested_part = victim.get_bodypart(BODY_ZONE_R_ARM)
@@ -39,7 +39,7 @@
/// This test is used for making sure species with bones but no flesh (skeletons, plasmamen) can only suffer BONE_WOUNDS, and nothing tagged with FLESH_WOUND (it's possible to require both)
/datum/unit_test/test_human_bone/Run()
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
/// the limbs have no wound resistance like the chest and head do, so let's go with the r_arm
var/obj/item/bodypart/tested_part = victim.get_bodypart(BODY_ZONE_R_ARM)
+5 -5
View File
@@ -2,7 +2,7 @@
// Pause natural mob life so it can be handled entirely by the test
SSmobs.pause()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/list/blacklisted_reagents = list(
/datum/reagent/eigenstate, //Creates clones after a delay which get into other tests
)
@@ -22,7 +22,7 @@
/datum/unit_test/on_mob_end_metabolize/Run()
SSmobs.pause()
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/obj/item/reagent_containers/pill/pill = allocate(/obj/item/reagent_containers/pill)
var/datum/reagent/drug/methamphetamine/meth = /datum/reagent/drug/methamphetamine
@@ -47,9 +47,9 @@
/datum/unit_test/addictions/Run()
SSmobs.pause()
var/mob/living/carbon/human/pill_user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/syringe_user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/pill_syringe_user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/pill_user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/syringe_user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/pill_syringe_user = allocate(/mob/living/carbon/human/consistent)
var/datum/mind/pill_mind = new /datum/mind("Mothcocks")
pill_mind.active = TRUE
+1 -1
View File
@@ -6,7 +6,7 @@
/datum/unit_test/actions_moved_on_mind_transfer/Run()
var/mob/living/carbon/human/wizard = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/wizard = allocate(/mob/living/carbon/human/consistent)
var/mob/living/simple_animal/pet/dog/corgi/wizard_dog = allocate(/mob/living/simple_animal/pet/dog/corgi)
wizard.mind_initialize()
+2 -1
View File
@@ -19,7 +19,8 @@
if(ghost_role.outfit_override)
TEST_FAIL("[ghost_role.type] has a defined \"outfit_override\" list, which is only for mapping. Do not set this!")
if(ghost_role.mob_type != /mob/living/carbon/human)
var/human_type = /mob/living/carbon/human // this exists to prevent being caught by checks
if(ghost_role.mob_type != human_type)
//vars that must not be set if the mob type isn't human
var/list/human_only_vars = list(
"mob_species",
+1 -1
View File
@@ -15,7 +15,7 @@
/datum/unit_test/monkey_business/Run()
var/start_runtimes = GLOB.total_runtimes
for(var/monkey_id in 1 to length(GLOB.the_station_areas))
var/mob/living/carbon/human/monkey = allocate(/mob/living/carbon/human, get_first_open_turf_in_area(GLOB.the_station_areas[monkey_id]))
var/mob/living/carbon/human/monkey = allocate(/mob/living/carbon/human/consistent, get_first_open_turf_in_area(GLOB.the_station_areas[monkey_id]))
monkey.set_species(/datum/species/monkey)
monkey.set_name("Monkey [monkey_id]")
if(monkey_id % monkey_angry_nth == 0) // BLOOD FOR THE BLOOD GODS
+2 -2
View File
@@ -2,8 +2,8 @@
/datum/unit_test/novaflower_burn
/datum/unit_test/novaflower_burn/Run()
var/mob/living/carbon/human/botanist = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/botanist = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/obj/item/grown/novaflower/weapon = allocate(/obj/item/grown/novaflower)
TEST_ASSERT(weapon.force > 0, "[weapon] spawned with zero force.")
+1 -1
View File
@@ -15,7 +15,7 @@
/datum/unit_test/nuke_cinematic/Run()
var/obj/machinery/nuclearbomb/syndicate/nuke = allocate(/obj/machinery/nuclearbomb/syndicate)
var/mob/living/carbon/human/nuked = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/nuked = allocate(/mob/living/carbon/human/consistent)
var/datum/client_interface/mock_client = new
nuked.mock_client = mock_client
mock_client.mob = nuked
+3 -3
View File
@@ -5,9 +5,9 @@
/datum/unit_test/operating_table/Run()
var/obj/structure/table/optable/table = allocate(/obj/structure/table/optable)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human, get_step(table, NORTH))
var/mob/living/carbon/human/replacement_human = allocate(/mob/living/carbon/human, get_step(table, NORTH))
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent, get_step(table, NORTH))
var/mob/living/carbon/human/replacement_human = allocate(/mob/living/carbon/human/consistent, get_step(table, NORTH))
// Resting is a bit more high level than bodypos, gets us nicer coverage.
human.set_resting(new_resting = FALSE, instant = TRUE)
replacement_human.set_resting(new_resting = FALSE, instant = TRUE)
+2 -2
View File
@@ -22,7 +22,7 @@
/datum/unit_test/outfit_sanity/Run()
var/datum/outfit/prototype_outfit = /datum/outfit
var/prototype_name = initial(prototype_outfit.name)
var/mob/living/carbon/human/H = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/H = allocate(/mob/living/carbon/human/consistent)
for (var/outfit_type in subtypesof(/datum/outfit))
// Only make one human and keep undressing it because it's much faster
@@ -30,7 +30,7 @@
qdel(I)
var/datum/outfit/outfit = new outfit_type
if(outfit.name == prototype_name)
TEST_FAIL("[outfit.type]'s name is invalid! Uses default outfit name!")
outfit.pre_equip(H, TRUE)
+1 -1
View File
@@ -1,5 +1,5 @@
/datum/unit_test/pills/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/item/reagent_containers/pill/iron/pill = allocate(/obj/item/reagent_containers/pill/iron)
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/iron), FALSE, "Human somehow has iron before taking pill")
@@ -4,7 +4,7 @@
/datum/unit_test/plane_double_transform/Run()
// We're going to operate off the actual plane master setup of an actual mob
// It's not perfect, but it'll help things a lot
var/mob/living/carbon/human/judger = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/judger = allocate(/mob/living/carbon/human/consistent)
// Hack to account for not having an actual hud
var/datum/plane_master_group/hudless/our_group = allocate(/datum/plane_master_group/hudless)
our_group.our_mob = judger
+1 -1
View File
@@ -3,7 +3,7 @@
/datum/unit_test/preferences_implement_everything/Run()
var/datum/preferences/preferences = new(new /datum/client_interface)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
for (var/preference_type in GLOB.preference_entries)
var/datum/preference/preference = GLOB.preference_entries[preference_type]
+2 -2
View File
@@ -7,8 +7,8 @@
/datum/unit_test/gun_go_bang/Run()
// test is for a ballistic gun that starts loaded + chambered
var/obj/item/gun/test_gun = allocate(/obj/item/gun/ballistic/automatic/pistol)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/gunner = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/gunner = allocate(/mob/living/carbon/human/consistent)
ADD_TRAIT(victim, TRAIT_PIERCEIMMUNE, INNATE_TRAIT) // So the human isn't randomly affected by shrapnel
var/obj/item/ammo_casing/loaded_casing = test_gun.chambered
+1 -1
View File
@@ -11,7 +11,7 @@
/datum/unit_test/frame_stacking/Run()
// First test - RCDs stacking frames.
var/obj/item/construction/rcd/rcd = allocate(/obj/item/construction/rcd/combat/admin)
var/mob/living/carbon/human/engineer = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/engineer = allocate(/mob/living/carbon/human/consistent)
engineer.put_in_hands(rcd, forced = TRUE)
@@ -14,7 +14,7 @@
// Life() is handled just by tests
SSmobs.pause()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/item/reagent_containers/dropper/dropper = allocate(/obj/item/reagent_containers/dropper)
var/obj/item/reagent_containers/cup/glass/bottle/drink = allocate(/obj/item/reagent_containers/cup/glass/bottle)
var/obj/item/reagent_containers/pill/patch/patch = allocate(/obj/item/reagent_containers/pill/patch)
+1 -1
View File
@@ -1,5 +1,5 @@
/datum/unit_test/reagent_mob_procs/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/item/food/hotdog/debug/fooditem = allocate(/obj/item/food/hotdog/debug)
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/consumable/ketchup), FALSE, "Human somehow has ketchup before eating")
+2 -2
View File
@@ -1,6 +1,6 @@
/// Test that stop, drop, and roll lowers fire stacks
/datum/unit_test/stop_drop_and_roll/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
TEST_ASSERT_EQUAL(human.fire_stacks, 0, "Human does not have 0 fire stacks pre-ignition")
@@ -20,7 +20,7 @@
/// Test that you can resist out of a container
/datum/unit_test/container_resist/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/structure/closet/closet = allocate(/obj/structure/closet, get_turf(human))
closet.open(human)
+1 -1
View File
@@ -3,7 +3,7 @@
var/mob/host_mob
/datum/unit_test/get_message_mods/Run()
host_mob = allocate(/mob/living/carbon/human)
host_mob = allocate(/mob/living/carbon/human/consistent)
test("Hello", "Hello", list())
test(";HELP", "HELP", list(MODE_HEADSET = TRUE))
@@ -66,7 +66,7 @@
TEST_ASSERT(write_success, "Couldn't write department [SECURITY_OFFICER_DEPARTMENTS_TO_NAMES[preference]]")
var/mob/living/carbon/human/new_character = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/new_character = allocate(/mob/living/carbon/human/consistent)
new_character.mind_initialize()
new_character.mind.set_assigned_role(SSjob.GetJobType(/datum/job/security_officer))
@@ -85,7 +85,7 @@
var/list/distribution = list()
for (var/officer_preference in preferences_of_others)
var/mob/officer = allocate(/mob/living/carbon/human)
var/mob/officer = allocate(/mob/living/carbon/human/consistent)
distribution[officer] = officer_preference
var/result = get_new_officer_distribution_from_late_join(
+1 -1
View File
@@ -2,7 +2,7 @@
* Check that standard food items fit on the serving tray
*/
/datum/unit_test/servingtray/Run()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/structure/table/the_table = allocate(/obj/structure/table)
var/obj/item/storage/bag/tray/test_tray = allocate(/obj/item/storage/bag/tray)
var/obj/item/food/banana = allocate(/obj/item/food/rationpack)
+2 -2
View File
@@ -3,13 +3,13 @@
/datum/unit_test/slips/Run()
// Test just forced slipping, which calls turf slip code as well.
var/mob/living/carbon/human/mso = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/mso = allocate(/mob/living/carbon/human/consistent)
TEST_ASSERT(mso.slip(100) == TRUE, "/mob/living/carbon/human/slip() returned FALSE when TRUE was expected")
TEST_ASSERT(!!(mso.IsKnockdown()), "/mob/living/carbon/human/slip() failed to knockdown target when knockdown was expected")
// Test the slipping component, which calls mob slip code. Just for good measure.
var/mob/living/carbon/human/msos_friend_mso = allocate(/mob/living/carbon/human, run_loc_floor_bottom_left)
var/mob/living/carbon/human/msos_friend_mso = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left)
var/obj/item/grown/bananapeel/specialpeel/mso_bane = allocate(/obj/item/grown/bananapeel/specialpeel, get_step(run_loc_floor_bottom_left, EAST))
msos_friend_mso.Move(get_turf(mso_bane), EAST)
@@ -6,7 +6,7 @@
/datum/unit_test/species_change_organs
/datum/unit_test/species_change_organs/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
// Give a trauma
dummy.gain_trauma(/datum/brain_trauma/severe/blindness)
+2 -2
View File
@@ -9,8 +9,8 @@
/datum/unit_test/mind_swap_spell/Run()
var/mob/living/carbon/human/swapper = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/to_swap = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/swapper = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/to_swap = allocate(/mob/living/carbon/human/consistent)
swapper.forceMove(run_loc_floor_bottom_left)
to_swap.forceMove(locate(run_loc_floor_bottom_left.x + 1, run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z))
+2 -2
View File
@@ -25,7 +25,7 @@
/datum/unit_test/shapeshift_spell/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
dummy.mind_initialize()
for(var/spell_type in subtypesof(/datum/action/cooldown/spell/shapeshift))
@@ -81,7 +81,7 @@
/datum/unit_test/shapeshift_holoparasites/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
var/datum/action/cooldown/spell/shapeshift/wizard/shift = new(dummy)
shift.shapeshift_type = shift.possible_shapes[1]
+1 -1
View File
@@ -3,7 +3,7 @@
// Pause natural mob life so it can be handled entirely by the test
SSmobs.pause()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/obj/item/food/hotdog/debug/fooditem = allocate(/obj/item/food/hotdog/debug)
var/obj/item/organ/internal/stomach/belly = human.getorganslot(ORGAN_SLOT_STOMACH)
var/obj/item/reagent_containers/pill/pill = allocate(/obj/item/reagent_containers/pill)
+1 -1
View File
@@ -11,7 +11,7 @@
strange_reagent = new
var/list/types_to_check = typecacheof(list(
/mob/living/carbon/human,
/mob/living/carbon/human/consistent,
/mob/living/simple_animal,
/mob/living/basic,
))
+1 -1
View File
@@ -3,7 +3,7 @@
var/obj/target = allocate(/obj/item/pen, run_loc_floor_bottom_left)
var/datum/element/strippable/strippable = target.AddElement(/datum/element/strippable, list())
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human, run_loc_floor_bottom_left)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left)
ADD_TRAIT(user, TRAIT_PRESERVE_UI_WITHOUT_CLIENT, TRAIT_SOURCE_UNIT_TESTS)
var/datum/strip_menu/strip_menu = allocate(/datum/strip_menu, target, strippable)
+16 -16
View File
@@ -1,6 +1,6 @@
/datum/unit_test/amputation/Run()
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
TEST_ASSERT_EQUAL(patient.get_missing_limbs().len, 0, "Patient is somehow missing limbs before surgery")
@@ -13,13 +13,13 @@
TEST_ASSERT_EQUAL(patient.get_missing_limbs()[1], BODY_ZONE_R_ARM, "Patient is missing a limb that isn't the one we operated on")
/datum/unit_test/brain_surgery/Run()
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent)
patient.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_SURGERY)
patient.setOrganLoss(ORGAN_SLOT_BRAIN, 20)
TEST_ASSERT(patient.has_trauma_type(), "Patient does not have any traumas, despite being given one")
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/datum/surgery_step/fix_brain/fix_brain = new
fix_brain.success(user, patient)
@@ -28,9 +28,9 @@
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)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/alice = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/bob = allocate(/mob/living/carbon/human/consistent)
alice.fully_replace_character_name(null, "Alice")
bob.fully_replace_character_name(null, "Bob")
@@ -55,9 +55,9 @@
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)
var/mob/living/carbon/human/patient_one = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/patient_zero = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/patient_one = allocate(/mob/living/carbon/human/consistent)
var/obj/item/scalpel/scalpel = allocate(/obj/item/scalpel)
@@ -81,8 +81,8 @@
/datum/unit_test/start_tend_wounds
/datum/unit_test/start_tend_wounds/Run()
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/datum/surgery/surgery = new /datum/surgery/healing/brute/basic
@@ -92,10 +92,10 @@
qdel(surgery)
/datum/unit_test/tend_wounds/Run()
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent)
patient.take_overall_damage(100, 100)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
// Test that tending wounds actually lowers damage
var/datum/surgery_step/heal/brute/basic/basic_brute_heal = new
@@ -107,10 +107,10 @@
TEST_ASSERT(patient.getFireLoss() < 100, "Tending burn wounds didn't lower burn damage ([patient.getFireLoss()])")
// Test that wearing clothing lowers heal amount
var/mob/living/carbon/human/naked_patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/naked_patient = allocate(/mob/living/carbon/human/consistent)
naked_patient.take_overall_damage(100)
var/mob/living/carbon/human/clothed_patient = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/clothed_patient = allocate(/mob/living/carbon/human/consistent)
clothed_patient.equipOutfit(/datum/outfit/job/doctor, TRUE)
clothed_patient.take_overall_damage(100)
+1 -1
View File
@@ -8,7 +8,7 @@
/datum/unit_test/wizard_loadout/Run()
for(var/loadout in ALL_WIZARD_LOADOUTS)
var/obj/item/spellbook/wizard_book = allocate(/obj/item/spellbook)
var/mob/living/carbon/human/wizard = allocate(/mob/living/carbon/human)
var/mob/living/carbon/human/wizard = allocate(/mob/living/carbon/human/consistent)
wizard.mind_initialize()
wizard.put_in_active_hand(wizard_book, forced = TRUE)
wizard_book.wizard_loadout(wizard, loadout)