Files
Aurora.3/code/unit_tests/hydroponics_tests.dm
Wildkins 290032afc7 Turn hydroponics get and set_trait into defines (#21404)
Hydroponics tray processing is a massive chunk of machinery processing
for no good reason, I have a sneaking suspicion that this is due to proc
overhead on get_trait, as process can call it upwards of 30 times per
tick per tray.

Realistically most of the things that are traits should instead be
variables, but that's a refactor for someone with more time.
2025-09-28 12:09:49 +00:00

28 lines
1.1 KiB
Plaintext

/*
For unit tests relating to hydroponics mechanics, with no direct relation to cooking.
*/
/**
Checks if the preference values of a seed are lesser than their tolerance values.
Preferences should always be within tolerances. We don't want any plant to be dying from intolerance
while simultaneously growing faster from being within its preferences.
*/
/datum/unit_test/seed_preferences_check
name = "HYDROPONICS: Check preference and tolerance validity"
groups = list("generic", "cooking")
/datum/unit_test/seed_preferences_check/start_test()
for(var/seed_name in SSplants.seeds)
var/datum/seed/S = SSplants.seeds[seed_name]
if(GET_SEED_TRAIT(S, TRAIT_LIGHT_TOLERANCE) < GET_SEED_TRAIT(S, TRAIT_LIGHT_PREFERENCE))
TEST_FAIL("Seed [S] has a light preference value set higher than its light tolerance.")
if(GET_SEED_TRAIT(S, TRAIT_HEAT_TOLERANCE) < GET_SEED_TRAIT(S, TRAIT_HEAT_PREFERENCE))
TEST_FAIL("Seed [S] has a heat preference value set higher than its heat tolerance.")
if(!reported)
TEST_PASS("All seeds have preference values that are lower than their tolerance values.")
return 1