Files
VOREStation/code/unit_tests/unit_test.dm
Cameron Lennox 6a157d8614 Rig glovefix and Clothing protection fix (#17118)
* Fixes RIG gear to not drop your equipped items

Fixes the rig gear to not drop your equipped gear after undeployment

* better fix

* Fixes suits and RIGS

- Makes rigsuits no longer eat your gloves
- Allows you to properly wear a ring under a rigsuit
- Gets rid of a LOT of duplicate var  = XYZ in places
- Makes it so clothing actually properly provide protection to the areas they're covering. (This doesn't change anything unless their actual min_cold_protection or max_heat_protection is adjusted!)
- Adds a define for CHEST which is just UPPER_TORSO|LOWER_TORSO to make it clear it's protecting your WHOLE chest at a glance.
- Gives some things like knee-high and thigh-high boots proper leg protection

* Clothing unit test

* fixes

* oops

* hoods are snowflakes

* hood fix

* path fix

* no nullspace turf

* nullcheck

* don't test devwarning cloths

* ignore this too

* more exclusions

* more exclusions, disabled species test

* Changes So Far

* holding/wearing icons for clothing

* fixed

* more fixes

* lets try this again

* go

* tesh cloak

* some more

* devwarning

* the cursed one

* oops

* fixed species scan

* Update clothing.dm

* restrict this down a bit more, we don't want unit-test to choke

* no more CI killer

* suit defined name twice

* suit

* some more exclusions

* etc

* gwah

* gwah

* clarifying exclusions

* yet more exclusions

* another set of exclusions

* ranger

* compile

* more bitflag

* yet more exclusions

* more

* more missing

* Update sifguard.dm

comment (also to wake up travis)

* more exclusions

* sifguard

* more exclusions

* more

* send help, yes more exclusions

* lost to time

* skrell stuff

* offear is special

* fixes more and unbreaks protean rigs

* The big one

* wrong ifdef

* more

* boots

* Update accessory.dm

* small object fix

* lets be more careful

* Does this fix the signal

* is it the signal?

* FIXES THE REST OF THEM

* wah

* disable test

* the last one

* fix signal check

* fixes

* ignore storage

* teshari blacklist

* tesh

* God speed

* fixed progression removed lizard

* fixes some i guess but what's the point

* disable indepth check

* START ROBOT SPRITE VALIDITY

* Revert "START ROBOT SPRITE VALIDITY"

This reverts commit c9bfb7e9ce.

* consistency with another test

* yuh uh

---------

Co-authored-by: Willburd <7099514+Willburd@users.noreply.github.com>
2025-03-01 11:56:30 -05:00

114 lines
2.9 KiB
Plaintext

var/all_unit_tests_passed = 1
var/failed_unit_tests = 0
var/total_unit_tests = 0
/datum/unit_test
var/name = "template"
var/disabled = ""
var/async = 0
var/reported = 0
/datum/unit_test/proc/fail(var/message)
all_unit_tests_passed = 0
failed_unit_tests++
reported = 1
log_unit_test("[ASCII_RED]!! FAILURE !! \[[name]\]: [message][ASCII_RESET]")
/datum/unit_test/proc/pass(var/message)
reported = 1
log_unit_test("[ASCII_GREEN]** SUCCESS ** \[[name]\]: [message][ASCII_RESET]")
/datum/unit_test/proc/start_test()
fail("No test proc.")
/datum/unit_test/proc/check_result()
fail("No check results proc.")
return 1
/proc/initialize_unit_tests()
log_unit_test("Initializing Unit Testing")
if(!ticker)
stack_trace("No Ticker")
world.Del()
var/said_msg = 0
while(!Master.current_runlevel) // Make sure the initial startup is complete.
if(!said_msg)
said_msg = 1
log_unit_test("Waiting for subystems initilization to finish.")
stoplag(10)
world.save_mode("extended")
sleep(1)
ticker.current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
log_unit_test("Round has been started. Waiting 10 seconds to start tests.")
sleep(100)
var/list/test_datums = typesof(/datum/unit_test)
var/list/async_test = list()
var/list/started_tests = list()
log_unit_test("Testing Started.")
for(var/test in test_datums)
var/datum/unit_test/d = new test()
if(d.disabled)
d.pass("[ASCII_RED]Check Disabled: [d.disabled][ASCII_RESET]")
continue
if(findtext(d.name, "template"))
continue
if(isnull(d.start_test())) // Start the test.
d.fail("Test Runtimed")
if(d.async) // If it's async then we'll need to check back on it later.
async_test.Add(d)
total_unit_tests++
//
// Check the async tests to see if they are finished.
//
while(async_test.len)
for(var/datum/unit_test/test in async_test)
if(test.check_result())
async_test.Remove(test)
sleep(1)
//
// Make sure all Unit Tests reported a result
//
for(var/datum/unit_test/test in started_tests)
if(!test.reported)
test.fail("Test failed to report a result.")
if(all_unit_tests_passed)
log_unit_test("[ASCII_GREEN]*** All Unit Tests Passed \[[total_unit_tests]\] ***[ASCII_RESET]")
else
log_unit_test("[ASCII_RED]!!! \[[failed_unit_tests]\\[total_unit_tests]\] Unit Tests Failed !!![ASCII_RESET]")
log_unit_test("Caught [GLOB.total_runtimes] Runtime\s.")
world.Del()
/datum/unit_test/proc/get_standard_turf()
return locate(20,20,1)
/datum/unit_test/proc/log_bad(var/message)
log_unit_test("[ASCII_RED]\[[name]\]: [message][ASCII_RESET]")
/datum/unit_test/proc/log_debug(var/message)
log_unit_test("[ASCII_YELLOW]--- DEBUG --- \[[name]\]: [message][ASCII_RESET]")
// This signal should never be possible to call if the game is not compiled for unit tests
/datum/unit_test/proc/get_signal_data(atom/source, list/data = list())
SIGNAL_HANDLER