mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 22:17:32 +01:00
Unit tests!
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
var/mappath = null
|
||||
var/mapfile = null
|
||||
var/loaded = 0 // Times loaded this round
|
||||
/// Do we exclude this from CI checks? If so, set this to the templates pathtype itself to avoid it getting passed down
|
||||
var/ci_exclude = null // DO NOT SET THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING
|
||||
|
||||
/datum/map_template/New(path = null, map = null, rename = null)
|
||||
if(path)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/datum/map_template/ruin/lavaland/biodome
|
||||
cost = 5
|
||||
allow_duplicates = FALSE
|
||||
ci_exclude = /datum/map_template/ruin/lavaland/biodome // This is a parent holder, not a ruin itself
|
||||
|
||||
/datum/map_template/ruin/lavaland/biodome/beach
|
||||
name = "Biodome Beach"
|
||||
@@ -71,6 +72,7 @@
|
||||
/datum/map_template/ruin/lavaland/sin
|
||||
cost = 10
|
||||
allow_duplicates = FALSE
|
||||
ci_exclude = /datum/map_template/ruin/lavaland/sin // This is a parent holder, not a ruin itself
|
||||
|
||||
/datum/map_template/ruin/lavaland/sin/envy
|
||||
name = "Ruin of Envy"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#ifdef UNIT_TESTS
|
||||
#include "component_tests.dm"
|
||||
#include "config_sanity.dm"
|
||||
#include "crafting_lists.dm"
|
||||
#include "log_format.dm"
|
||||
#include "map_templates.dm"
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// This one test does multiple config things
|
||||
///datum/unit_test/config_stanity/Run()
|
||||
/client/verb/test_config_sanity()
|
||||
// First test the ruins. Space then lava.
|
||||
var/list/config_space_ruins = GLOB.configuration.ruins.active_space_ruins.Copy() // Copy so we dont remove
|
||||
var/list/datum/map_template/ruin/space/game_space_ruins = list()
|
||||
|
||||
// Yes I know this is inefficient. Sue me.
|
||||
for(var/path in subtypesof(/datum/map_template/ruin/space))
|
||||
var/datum/map_template/ruin/space/S = new path()
|
||||
// istype() doesnt work here. Dont even try it.
|
||||
if(S.ci_exclude == S.type)
|
||||
continue
|
||||
game_space_ruins.Add(S)
|
||||
|
||||
for(var/datum/map_template/ruin/space/S in game_space_ruins)
|
||||
if(S.mappath in config_space_ruins)
|
||||
// Remove both
|
||||
game_space_ruins -= S
|
||||
config_space_ruins -= S.mappath
|
||||
|
||||
// Do not confuse this with the map_templates unit test. They do different things!!!!!
|
||||
if(length(game_space_ruins))
|
||||
Fail("Space ruins exist in the game code that do not exist in the config file")
|
||||
for(var/datum/map_template/ruin/space/S in game_space_ruins)
|
||||
Fail("Ruin [S.type] does not have a valid map path ([S.mappath])")
|
||||
|
||||
if(length(config_space_ruins))
|
||||
Fail("Space ruins exist in the game config that do not have associated datums")
|
||||
for(var/path in config_space_ruins)
|
||||
Fail("- [path]")
|
||||
|
||||
|
||||
// Now for lava ruins
|
||||
var/list/config_lava_ruins = GLOB.configuration.ruins.active_lava_ruins.Copy() // Copy so we dont remove
|
||||
var/list/datum/map_template/ruin/space/game_lava_ruins = list()
|
||||
|
||||
// Yes I know this is inefficient. Sue me.
|
||||
for(var/path in subtypesof(/datum/map_template/ruin/lavaland))
|
||||
var/datum/map_template/ruin/lavaland/L = new path()
|
||||
// istype() doesnt work here. Dont even try it.
|
||||
if(L.ci_exclude == L.type)
|
||||
continue
|
||||
game_lava_ruins.Add(L)
|
||||
|
||||
for(var/datum/map_template/ruin/lavaland/L in game_lava_ruins)
|
||||
if(L.mappath in config_lava_ruins)
|
||||
// Remove both
|
||||
game_lava_ruins -= L
|
||||
config_lava_ruins -= L.mappath
|
||||
|
||||
// Do not confuse this with the map_templates unit test. They do different things!!!!!
|
||||
if(length(game_lava_ruins))
|
||||
Fail("Lava ruins exist in the game code that do not exist in the config file")
|
||||
for(var/datum/map_template/ruin/lavaland/L in game_lava_ruins)
|
||||
Fail("Ruin [L.type] does not have a valid map path ([L.mappath])")
|
||||
|
||||
if(length(config_lava_ruins))
|
||||
Fail("Lava ruins exist in the game config that do not have associated datums")
|
||||
for(var/path in config_lava_ruins)
|
||||
Fail("- [path]")
|
||||
@@ -2,6 +2,10 @@
|
||||
var/list/datum/map_template/templates = subtypesof(/datum/map_template)
|
||||
for(var/I in templates)
|
||||
var/datum/map_template/MT = new I // The new is important here to ensure stuff gets set properly
|
||||
if(MT.ci_exclude == MT.type)
|
||||
continue
|
||||
// Check if it even has a path and if so, does it exist
|
||||
if(MT.mappath && !fexists(MT.mappath))
|
||||
Fail("The map file for [MT.type] does not exist!")
|
||||
if(MT.mappath && !findtext(MT.mappath, ".dmm"))
|
||||
Fail("The map file for [MT.type] is not a map!")
|
||||
|
||||
@@ -611,6 +611,14 @@ active_space_ruins = [
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/intactemptyship.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/mechtransport.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/turretedoutpost.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/debris1.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/debris2.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/debris3.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/listeningpost.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/oldstation.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/onehalf.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/syndiecakesfactory.dmm",
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/wizardcrash.dmm",
|
||||
|
||||
### The following ruins are based from past pre-spawned Zlevel content ###
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/abandonedtele.dmm",
|
||||
@@ -631,7 +639,7 @@ active_space_ruins = [
|
||||
|
||||
# The following is a force-spawned ruin consisting mostly of empty space with a shuttle docking port for the free golem shuttle
|
||||
# Disabling it will lead to the free golem shuttle sometimes being stuck on lavaland.
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/golemtarget.dmm"
|
||||
"_maps/map_files/RandomRuins/SpaceRuins/golemtarget.dmm",
|
||||
]
|
||||
# List of all ruins that can generate on lavaland
|
||||
# Commenting something out in here DISABLES IT FROM SPAWNING
|
||||
@@ -642,31 +650,32 @@ active_lava_ruins = [
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_biodome_winter.dmm",
|
||||
##RESPAWN
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_ash_walker1.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_hermit.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_seed_vault.dmm",
|
||||
##SIN
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_envy.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_gluttony.dmm",
|
||||
# Greed blacklisted because its reward (dice) has a 1/20 chance of making you a wizard
|
||||
#"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_greed.dmm",
|
||||
# Greed blacklisted on production because its reward (dice) has a 1/20 chance of making you a wizard
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_greed.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pride.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm",
|
||||
##MEGAFAUNA
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_blooddrunk1.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_blooddrunk2.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_blooddrunk3.dmm",
|
||||
#re-removed 7/24/2020, I ran a month-long test of hierophant Jun-Jul and the staff was still too strong. https://github.com/ParadiseSS13/Paradise/pull/13542
|
||||
#"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_hierophant.dmm",
|
||||
# Re-removed 7/24/2020, I ran a month-long test of hierophant Jun-Jul and the staff was still too strong. https://github.com/ParadiseSS13/Paradise/pull/13542
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_hierophant.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_swarmer_crash.dmm",
|
||||
|
||||
##MISC
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_animal_hospital.dmm",
|
||||
# Cube blacklisted because it contains a wishgranter that gives you hijack on use
|
||||
#"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_cube.dmm",
|
||||
# Cube blacklisted on production because it contains a wishgranter that gives you hijack on use
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_cube.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_cultaltar.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_dead_ratvar.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_fountain_hell.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizza_party.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_fountain_hall.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_pizzaparty.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_puzzle.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_random_ripley.dmm",
|
||||
"_maps/map_files/RandomRuins/LavaRuins/lavaland_surface_survivalpod.dmm",
|
||||
|
||||
Reference in New Issue
Block a user