Files
Aurora.3/code/unit_tests/equipment_tests.dm
Fluffy a4f8285686 Refactor of, and more, unit tests (#16065)
* Initial experiment

* holy shit the pain of this rabbit hole

* F

* F

* F

* F

* FFF

* FFFF

* FFFFFFFFF

* FFFFFFFFFF

* FF

* ffffff

* ffffffff

* F^F

* FFFFFF

* F

* Robusted

* F

* Some readability, hopefully

* Fear

* Aurora was a mistake

* Horrors beyond our comprehension

* Use the appropriate macro across the tests

* Brah

* FF

* Mute janitors robusting the ling

* Frail doctors revealing to be more trained than a KGB sleeper agent when the crew armory opens

* FFFFFFF

* gujbjh

* Shitcode, shitcode everywhere

* Pain

* Cursed codebase

* Fix AI mask qdel, SQL tests to macro

* Attempt at github grouping

* Take two

* Brah

* Maybe this looks better

* Different formatting

* FFS

* Visuals

* pain

* FFFFF

* hyuh

* fgdsgd

* igyguybujgb

* Just calling the parent here

* dsfs

* fdsaf

* Move more pieces to use the macros

* Finish moving to macro

* gah

* Changelog, some touchups

* Fix another found runtime

* GDI
2023-04-03 10:47:31 +00:00

64 lines
1.4 KiB
Plaintext

#define SUCCESS 1
#define FAILURE 0
datum/unit_test/vision_glasses/
name = "EQUIPMENT: Vision Template"
var/mob/living/carbon/human/H = null
var/expectation = SEE_INVISIBLE_NOLIGHTING
var/glasses_type = null
async = 1
datum/unit_test/vision_glasses/start_test()
var/list/test = create_test_mob_with_mind(null, /mob/living/carbon/human)
if(isnull(test))
TEST_FAIL("Check Runtimed in Mob creation")
if(test["result"] == FAILURE)
TEST_FAIL(test["msg"])
async = 0
return 0
H = locate(test["mobref"])
var/obj/item/clothing/glasses/G = new glasses_type()
H.glasses = G
return 1
datum/unit_test/vision_glasses/check_result()
if(isnull(H) || H.life_tick < 2)
return 0
if(isnull(H.glasses))
TEST_FAIL("Mob doesn't have glasses on")
H.handle_vision() // Because Life has a client check that bypasses updating vision
if(H.see_invisible == expectation)
TEST_PASS("Mob See invisible is [H.see_invisible]")
else
TEST_FAIL("Mob See invisible is [H.see_invisible] / expected [expectation]")
return 1
datum/unit_test/vision_glasses/NVG
name = "EQUIPMENT: NVG see_invis"
glasses_type = /obj/item/clothing/glasses/night
datum/unit_test/vision_glasses/mesons
name = "EQUIPMENT: Mesons see_invis"
glasses_type = /obj/item/clothing/glasses/meson
datum/unit_test/vision_glasses/plain
name = "EQUIPMENT: Plain glasses. see_invis"
glasses_type = /obj/item/clothing/glasses/regular
expectation = SEE_INVISIBLE_LIVING
#undef SUCCESS
#undef FAILURE