From 3fce8848d8221b7c06128f18caf4e5c36dea3a7d Mon Sep 17 00:00:00 2001 From: ccomp5950 Date: Sat, 16 Jan 2016 01:03:41 -0500 Subject: [PATCH] Adds unit test to check for icon states for robutt modules. Why? For the glory of Nar'Sie of course! --- code/unit_tests/mob_tests.dm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/code/unit_tests/mob_tests.dm b/code/unit_tests/mob_tests.dm index dabdb9b0815..28a50c31383 100644 --- a/code/unit_tests/mob_tests.dm +++ b/code/unit_tests/mob_tests.dm @@ -478,6 +478,38 @@ datum/unit_test/mob_damage/machine/halloss name = "MOB: IPC Halloss Damage Check" damagetype = HALLOSS + +// ============================================================================== + + +datum/unit_test/robot_module_icons + name = "MOB: Robot module icon check" + var/icon_file = 'icons/mob/screen1_robot.dmi' + +datum/unit_test/robot_module_icons/start_test() + var/failed = 0 + if(!isicon(icon_file)) + fail("[icon_file] is not a valid icon file.") + return 1 + + var/list/valid_states = icon_states(icon_file) + + if(!valid_states.len) + return 1 + + for(var/i=1, i<=robot_modules.len, i++) + var/bad_msg = "[ascii_red]--------------- [robot_modules[i]]" + if(!(lowertext(robot_modules[i]) in valid_states)) + log_unit_test("[bad_msg] does not contain a valid icon state in [icon_file][ascii_reset]") + failed=1 + + if(failed) + fail("Some icon states did not exist") + else + pass("All modules had valid icon states") + + return 1 + #undef VULNERABLE #undef IMMUNE #undef SUCCESS