Files
Aurora.3/code/unit_tests/gamemode_tests.dm
Fluffy a4f8285686 Refactor of, and more, unit tests (#16065)
* Initial experiment

* holy shit the pain of this rabbit hole

* F

* F

* F

* F

* FFF

* FFFF

* FFFFFFFFF

* FFFFFFFFFF

* FF

* ffffff

* ffffffff

* F^F

* FFFFFF

* F

* Robusted

* F

* Some readability, hopefully

* Fear

* Aurora was a mistake

* Horrors beyond our comprehension

* Use the appropriate macro across the tests

* Brah

* FF

* Mute janitors robusting the ling

* Frail doctors revealing to be more trained than a KGB sleeper agent when the crew armory opens

* FFFFFFF

* gujbjh

* Shitcode, shitcode everywhere

* Pain

* Cursed codebase

* Fix AI mask qdel, SQL tests to macro

* Attempt at github grouping

* Take two

* Brah

* Maybe this looks better

* Different formatting

* FFS

* Visuals

* pain

* FFFFF

* hyuh

* fgdsgd

* igyguybujgb

* Just calling the parent here

* dsfs

* fdsaf

* Move more pieces to use the macros

* Finish moving to macro

* gah

* Changelog, some touchups

* Fix another found runtime

* GDI
2023-04-03 10:47:31 +00:00

36 lines
1.4 KiB
Plaintext

/datum/unit_test/gamemode
name = "GAMEMODE template"
/datum/unit_test/gamemode/required_enemies_check
name = "GAMEMODE: All modes shall have required_players and required_enemies greater than the required number of players for their antagonist types."
/datum/unit_test/gamemode/required_enemies_check/start_test()
var/list/failed = list()
for(var/mode in subtypesof(/datum/game_mode))
var/datum/game_mode/GM = new mode
var/min_antag_count = 0
for(var/antag_type in GM.antag_tags)
var/datum/antagonist/A = all_antag_types[antag_type]
if(GM.require_all_templates)
min_antag_count += A.initial_spawn_req
else
min_antag_count = max(min_antag_count, A.initial_spawn_req)
if(min_antag_count != GM.required_enemies)
failed += "[GM] ([GM.type]) requires [GM.required_enemies] enemies but its antagonist roles require [min_antag_count] players!"
if(min_antag_count > GM.required_players)
failed += "[GM] ([GM.type]) requires [GM.required_players] players but its antagonist roles require [min_antag_count] players!"
if(failed.len)
TEST_FAIL("Some gamemodes did not have high enough required_enemies or required_players.")
for(var/failed_message in failed)
TEST_FAIL(failed_message)
else
TEST_PASS("All gamemodes had suitable required_enemies and required_players.")
return 1