mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 02:01:22 +00:00
This PR fixes a case where certain materials caused issues when working with stacking machines, because they did not have set merge_type from the get go, which meant that initial() of that variable returned null. To clarify further - if /obj/item/stack does not have set merge_type, it is generated merge_type upon Initialize(), which is the same as its typepath. For example, currently /obj/item/stack/sheet/bluespace_crystal does not have any merge_type set, and it is given merge_type = /obj/item/stack/sheet/bluespace_crystal upon Initialize(). Each Initialize(). Again and again. There are quite a bit of these cases in the codebase, especially if its some older code. I have gone through them and set all of them their set merge_type, which they would inevitably receive anyway upon initializing and it fixes a bug mentioned above. To prevent this happening again, I have also included unit test to check if merge types are set for stacks, included exceptions are usually abstract paths like /obj/item/stack/sheet/mineral, which contains zero behavior on its own and does not spawn unless done via admin tools.
76 lines
2.4 KiB
Plaintext
76 lines
2.4 KiB
Plaintext
//include unit test files in this module in this ifdef
|
|
//Keep this sorted alphabetically
|
|
|
|
#ifdef UNIT_TESTS
|
|
|
|
/// Asserts that a condition is true
|
|
/// If the condition is not true, fails the test
|
|
#define TEST_ASSERT(assertion, reason) if (!(assertion)) { return Fail("Assertion failed: [reason || "No reason"]") }
|
|
|
|
/// Asserts that the two parameters passed are equal, fails otherwise
|
|
/// Optionally allows an additional message in the case of a failure
|
|
#define TEST_ASSERT_EQUAL(a, b, message) do { \
|
|
var/lhs = ##a; \
|
|
var/rhs = ##b; \
|
|
if (lhs != rhs) { \
|
|
return Fail("Expected [isnull(lhs) ? "null" : lhs] to be equal to [isnull(rhs) ? "null" : rhs].[message ? " [message]" : ""]"); \
|
|
} \
|
|
} while (FALSE)
|
|
|
|
/// Asserts that the two parameters passed are not equal, fails otherwise
|
|
/// Optionally allows an additional message in the case of a failure
|
|
#define TEST_ASSERT_NOTEQUAL(a, b, message) do { \
|
|
var/lhs = ##a; \
|
|
var/rhs = ##b; \
|
|
if (lhs == rhs) { \
|
|
return Fail("Expected [isnull(lhs) ? "null" : lhs] to not be equal to [isnull(rhs) ? "null" : rhs].[message ? " [message]" : ""]"); \
|
|
} \
|
|
} while (FALSE)
|
|
|
|
/// *Only* run the test provided within the parentheses
|
|
/// This is useful for debugging when you want to reduce noise, but should never be pushed
|
|
/// Intended to be used in the manner of `TEST_FOCUS(/datum/unit_test/math)`
|
|
#define TEST_FOCUS(test_path) ##test_path { focus = TRUE; }
|
|
|
|
#include "anchored_mobs.dm"
|
|
#include "bespoke_id.dm"
|
|
#include "binary_insert.dm"
|
|
#include "card_mismatch.dm"
|
|
#include "chain_pull_through_space.dm"
|
|
#include "combat.dm"
|
|
#include "component_tests.dm"
|
|
#include "confusion.dm"
|
|
#include "emoting.dm"
|
|
#include "heretic_knowledge.dm"
|
|
#include "keybinding_init.dm"
|
|
#include "machine_disassembly.dm"
|
|
#include "medical_wounds.dm"
|
|
#include "merge_type.dm"
|
|
#include "metabolizing.dm"
|
|
#include "outfit_sanity.dm"
|
|
#include "pills.dm"
|
|
#include "plantgrowth_tests.dm"
|
|
#include "quick_swap_sanity.dm"
|
|
#include "reagent_id_typos.dm"
|
|
#include "reagent_mod_expose.dm"
|
|
#include "reagent_mod_procs.dm"
|
|
#include "reagent_recipe_collisions.dm"
|
|
#include "resist.dm"
|
|
#include "say.dm"
|
|
#include "serving_tray.dm"
|
|
#include "siunit.dm"
|
|
#include "spawn_humans.dm"
|
|
#include "species_whitelists.dm"
|
|
#include "stomach.dm"
|
|
#include "subsystem_init.dm"
|
|
#include "surgeries.dm"
|
|
#include "teleporters.dm"
|
|
#include "timer_sanity.dm"
|
|
#include "unit_test.dm"
|
|
|
|
#undef TEST_ASSERT
|
|
#undef TEST_ASSERT_EQUAL
|
|
#undef TEST_ASSERT_NOTEQUAL
|
|
#undef TEST_FOCUS
|
|
#endif
|