Added a ruins UT (#18290)

* sdfa

* fas

* the godness guides, the godness protects

* sadf

* sdf

* fsa

* exoplanets_ruins config for UT

* sdaf

* sdf

* curse upon me
This commit is contained in:
Fluffy
2024-01-30 12:00:23 +01:00
committed by GitHub
parent 45390466f7
commit 1da2f6e7b8
21 changed files with 450 additions and 294 deletions
+47
View File
@@ -0,0 +1,47 @@
/*
* Ruins tests
* Basically loads the ruins to then check them
*/
/datum/unit_test/ruins_test
name = "Ruins Test"
groups = list("ruins")
priority = 100 //Have to load the ruins first if you want to check them later
/datum/unit_test/ruins_test/start_test()
return UNIT_TEST_SKIPPED
/datum/unit_test/ruins_test/exoplanet_ruins
name = "Exoplanet Ruins"
/datum/unit_test/ruins_test/exoplanet_ruins/start_test()
//Generate a planet WITH VACUUM ATMOS to use as a baseline
var/obj/effect/overmap/visitable/sector/exoplanet/barren/asteroid/test_exoplanet = new()
test_exoplanet.generate_atmosphere()
TEST_ASSERT(length(test_exoplanet.map_z), "The test exoplanet somehow doesn't have any level!")
//Set the exoplanet like it exists on the zlevel, so that exoplanet turfs can copy the atmosphere from and not cause
//active edges with the vacuum of space, since the exoplanet is without atmos as per above
for(var/zlevel in test_exoplanet.map_z[length(test_exoplanet.map_z)] to 1024) //I pray to the lord we won't ever have 1024 ruins
GLOB.map_sectors["[zlevel]"] = test_exoplanet
for(var/ruin in subtypesof(/datum/map_template/ruin/exoplanet))
var/datum/map_template/ruin/exoplanet/tested_ruin = new ruin()
var/turf/center_ruin = tested_ruin.load_new_z(FALSE)
if(!tested_ruin)
TEST_FAIL("Failed to load ruin [ruin]!")
return UNIT_TEST_FAILED
var/loaded_zlevel = null
if(center_ruin)
loaded_zlevel = center_ruin.z
else
TEST_WARN("Ruin [tested_ruin.name] didn't load in a Z level, or it could not be located, or it was not returned by the loader")
loaded_zlevel = "Unknown, read above!"
TEST_DEBUG("Loaded ruin [tested_ruin.name] in Z [loaded_zlevel]")
TEST_PASS("All the ruins in [src.name] loaded successfully!")
return UNIT_TEST_PASSED
+2 -1
View File
@@ -139,13 +139,14 @@ SUBSYSTEM_DEF(unit_tests)
for(var/group in D.groups)
if((group in SSunit_tests_config.config["unit_test_groups"]) || (SSunit_tests_config.config["unit_test_groups"][1] == "*"))
queue += D
BINARY_INSERT_PROC_COMPARE(D, queue, /datum/unit_test, D, compare_priority, COMPARE_KEY)
break
SSunit_tests_config.UT.notice("[queue.len] unit tests loaded.", __FILE__, __LINE__)
return SS_INIT_SUCCESS
/datum/controller/subsystem/unit_tests/proc/start_game()
if (SSticker.current_state == GAME_STATE_PREGAME)
SSticker.current_state = GAME_STATE_SETTING_UP
+9
View File
@@ -52,6 +52,9 @@ var/ascii_reset = "[ascii_esc]\[0m"
///A list of strings, each of which represents a group which this UT belongs to, the UT pods will only run UTs that are in their list
var/list/groups = list()
///The priority of the test, the larger it is the later it fires
var/priority = 1000
/*
* Log levels used to prettify correctly, only defined in this file (aka undef'd at the end)
@@ -140,6 +143,12 @@ var/ascii_reset = "[ascii_esc]\[0m"
fail("No check results proc")
return 1
/**
* Used to compare the priority of the tests to order them according to the `priority` var,
* so that tests with a lower value runs first
*/
/datum/unit_test/proc/compare_priority(datum/unit_test/comparedto)
return cmp_numeric_dsc(src.priority, comparedto.priority)
/proc/load_unit_test_changes()
/*
+3 -2
View File
@@ -206,8 +206,9 @@
return UNIT_TEST_PASSED
/**Something went wrong
* compose a message and fail the test, let the poor soul try to figure out where the issue is, assuming it's not intermittent
/*
Something went wrong
compose a message and fail the test, let the poor soul try to figure out where the issue is, assuming it's not intermittent
*/
var/fail_message = "[SSair.active_edges.len] edges active at round-start!\n"
for(var/connection_edge/E in SSair.active_edges)