Add unit tests for some surgeries, adds more APIs for unit tests to call (#52093)

* Add unit tests for medical related stuff

* Remove inaccurate assertion
This commit is contained in:
Jared-Fogle
2020-07-09 13:41:59 -04:00
committed by GitHub
parent 7b9a8dbf4b
commit 4b21913c58
4 changed files with 107 additions and 0 deletions
+15
View File
@@ -25,9 +25,11 @@ GLOBAL_VAR(test_log)
//internal shit
var/succeeded = TRUE
var/list/allocated
var/list/fail_reasons
/datum/unit_test/New()
allocated = new
run_loc_bottom_left = locate(1, 1, 1)
run_loc_top_right = locate(5, 5, 1)
@@ -35,6 +37,7 @@ GLOBAL_VAR(test_log)
//clear the test area
for(var/atom/movable/AM in block(run_loc_bottom_left, run_loc_top_right))
qdel(AM)
QDEL_LIST(allocated)
return ..()
/datum/unit_test/proc/Run()
@@ -48,6 +51,18 @@ GLOBAL_VAR(test_log)
LAZYADD(fail_reasons, reason)
/// Allocates an instance of the provided type, and places it somewhere in an available loc
/// Instances allocated through this proc will be destroyed when the test is over
/datum/unit_test/proc/allocate(type, ...)
var/list/arguments = args.Copy(2)
if (!arguments.len)
arguments = list(run_loc_bottom_left)
else if (arguments[1] == null)
arguments[1] = run_loc_bottom_left
var/instance = new type(arglist(arguments))
allocated += instance
return instance
/proc/RunUnitTests()
CHECK_TICK