mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
## About The Pull Request discussed in #93439, a generic proc for getting a list of all types minus abstract types. applies this to most instances of a for loop that currently filters out abstract types it SHOULD be a nothing burger for performance, however I have not bench marked the difference. (also testing, there is a total of 7 calls in init to it)
29 lines
1.4 KiB
Plaintext
29 lines
1.4 KiB
Plaintext
/// Tests that brain traumas can be granted and removed properly.
|
|
/datum/unit_test/trauma_granting
|
|
|
|
/datum/unit_test/trauma_granting/Run()
|
|
|
|
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
|
|
// It's not stricly necessary a mob must have a mind, but some traumas do extra stuff if you have mind.
|
|
dummy.mind_initialize()
|
|
|
|
// Following includes some traumas that would require special handling to test.
|
|
var/list/trauma_blacklist = list()
|
|
// Requires a phase be set in New
|
|
trauma_blacklist += typesof(/datum/brain_trauma/hypnosis)
|
|
// Requires another player, sleeps in gain()
|
|
trauma_blacklist += typesof(/datum/brain_trauma/severe/split_personality)
|
|
// Requires another player, sleeps in gain()
|
|
trauma_blacklist += typesof(/datum/brain_trauma/special/imaginary_friend)
|
|
// Requires a obsession target
|
|
trauma_blacklist += typesof(/datum/brain_trauma/special/obsessed)
|
|
|
|
for(var/datum/brain_trauma/trauma as anything in valid_subtypesof(/datum/brain_trauma) - trauma_blacklist)
|
|
test_trauma(dummy, trauma)
|
|
|
|
/datum/unit_test/trauma_granting/proc/test_trauma(mob/living/carbon/human/dummy, trauma)
|
|
dummy.gain_trauma(trauma)
|
|
TEST_ASSERT(dummy.has_trauma_type(trauma), "Brain trauma [trauma] failed to grant to dummy")
|
|
dummy.cure_trauma_type(trauma, TRAUMA_RESILIENCE_ABSOLUTE)
|
|
TEST_ASSERT(!dummy.has_trauma_type(trauma), "Brain trauma [trauma] failed to cure from dummy")
|