Adds Supply Shuttle Unit Tests.

Moves the Supply Shuttle and tests air in both locations.

turned the air test into a "helper" proc.

Changed the world.dm message when unit testing is enabled so folks aren't caught off guard when the server shutsdown after testing.
This commit is contained in:
ccomp5950
2015-12-29 19:34:51 -05:00
parent 94eb03c591
commit 997a6c66fd
4 changed files with 96 additions and 21 deletions

View File

@@ -10,7 +10,7 @@
// Tests Life() and mob breathing in space.
datum/unit_test/human_breath
name = "Human Suffocates in Space"
name = "Mob: Human Suffocates in Space"
var/starting_oxyloss = null
var/ending_oxyloss = null
var/mob/living/carbon/human/H

View File

@@ -47,7 +47,7 @@ proc/initialize_unit_tests()
world.Del()
log_unit_test("Waiting 10 seconds for roundstart functions to finish")
log_unit_test("Waiting 10 seconds or more for roundstart functions to finish")
sleep(100)
//
@@ -57,13 +57,13 @@ proc/initialize_unit_tests()
var/list/test_datums = typesof(/datum/unit_test) - /datum/unit_test
var/testnum = 1
//var/testnum = 1
var/list/async_test = list()
var/list/started_tests = list()
for (var/test in test_datums)
var/datum/unit_test/d = new test()
log_unit_test("Now starting \[[d.name]\] [testnum++] of [test_datums.len]")
//log_unit_test("Now starting \[[d.name]\] [testnum++] of [test_datums.len]")
if(isnull(d.start_test())) // Start the test.
d.fail("Test Runtimed")

View File

@@ -7,17 +7,30 @@
*/
//
// Tests Life() and mob breathing in space.
// Tests Pressurization of known problem areas.
datum/unit_test/zas_shuttle_pressure
name = "Escape Shuttle Pressurized"
datum/unit_test/zas_escape_shuttle
name = "ZAS: Escape Shuttle"
datum/unit_test/zas_shuttle_pressure/start_test()
//This needs to be broken down into a helper proc.
var/area/A = locate(/area/shuttle/escape/centcom)
datum/unit_test/zas_escape_shuttle/start_test()
var/list/result = test_air_in_area("/area/shuttle/escape/centcom")
if(isnull(result))
fail("Check Runtimed")
if(!istype(A, /area/shuttle/escape/centcom))
fail("Unable to get /area/shuttle/escape/centcom")
if(result["success"])
pass(result["msg"])
else
fail(result["msg"])
return 1
// ============================================================================
proc/test_air_in_area(var/A_txt)
var/test_area = text2path(A_txt)
var/area/A = locate(test_area)
if(!istype(A, test_area))
return(list("success" = 0, "msg" = "Unable to get [A_txt]"))
var/list/GM_checked = list()
@@ -33,19 +46,80 @@ datum/unit_test/zas_shuttle_pressure/start_test()
var/pressure = GM.return_pressure()
if(abs(pressure - ONE_ATMOSPHERE) > 10)
fail("Pressure out of bounds: [pressure]")
return 0
return(list("success" = 0, "msg" = "Pressure out of bounds: [pressure]"))
var/temp = GM.temperature
if(abs(temp - T20C) > 10)
fail("Temperature out of bounds: [temp]")
return 0
return(list("success" = 0, "msg" = "Temperature out of bounds: [temp]"))
GM_checked.Add(GM)
pass("Pass. Checked [GM_checked.len] zones")
if(GM_checked.len)
return(list("success"=1, "msg" = "Checked [GM_checked.len] zones"))
else
return(list("success"=0, "msg" = "No zones checked."))
datum/unit_test/zas_supply_shuttle_centcomm
name = "ZAS: Supply Shuttle (At CentComm)"
datum/unit_test/zas_supply_shuttle_centcomm/start_test()
var/list/result = test_air_in_area("/area/supply/dock")
if(isnull(result))
fail("Check Runtimed")
return 1
if(result["success"])
pass(result["msg"])
else
fail(result["msg"])
return 1
// ============================================================================
datum/unit_test/zas_supply_shuttle_moved
name = "ZAS: Supply Shuttle (When Moved)"
async=1 // We're moving the shuttle using built in procs.
var/datum/shuttle/ferry/supply/Shuttle = null
datum/unit_test/zas_supply_shuttle_moved/start_test()
if(!shuttle_controller || !shuttle_controller.shuttles.len)
fail("Shuttle Controller not setup at time of test.")
Shuttle = shuttle_controller.shuttles["Supply"]
supply_controller.movetime = 5 // Speed up the shuttle movement.
if(isnull(Shuttle))
fail("Unable to locate the supply shuttle")
// Initiate the Move.
Shuttle.short_jump(Shuttle.area_offsite, Shuttle.area_station)
sleep(20) // Give the shuttle some time to do it's thing.
return 1
datum/unit_test/zas_supply_shuttle_moved/check_result()
if(Shuttle.moving_status == SHUTTLE_IDLE && !Shuttle.at_station())
fail("Shuttle Did not Move")
return 1
if(!Shuttle.at_station())
return 0
sleep(20) // Give ZAS a chance to catchup.
var/list/result = test_air_in_area("/area/supply/station")
if(isnull(result))
fail("Check Runtimed")
return 1
if(result["success"])
pass(result["msg"])
else
fail(result["msg"])
return 1