test_fuel_initialization |
Verify fuel initializes to max capacity |
Instantiate resource with config values |
fuel == max_capacity |
test_fuel_consumption_static_exact |
Validate deterministic fuel consumption |
Apply fixed delta over N steps using constant rate |
fuel == start - (rate * total_time) (within tolerance) |
test_fuel_consumption_with_scaling |
Verify increased consumption during acceleration |
Simulate normal vs "speed_up" states with same delta |
Accelerated consumption > base consumption |
test_fuel_not_negative |
Ensure fuel is clamped at zero |
Simulate consumption beyond depletion |
fuel == 0.0 (never negative) |
test_fuel_exact_zero_transition |
Validate correct behavior at exact zero boundary |
Reduce fuel to exactly 0.0 |
No float drift; value equals 0.0 |
test_fuel_depletion_signal_emitted_once |
Ensure signal fires exactly once on depletion |
Observe signal while crossing from >0 → 0 |
fuel_depleted emitted once only |
test_multiple_depletion_signal_not_emitted_twice |
Prevent repeated signal spam |
Continue consumption after depletion |
No additional signals after first emission |
test_refuel_basic |
Verify refuel increases fuel correctly |
Apply refuel amount within capacity |
fuel == previous + amount |
test_refuel_clamped_to_max |
Ensure refuel does not exceed capacity |
Refuel beyond max capacity |
fuel == max_capacity |
test_refuel_negative_input |
Validate handling of invalid refuel input |
Call refuel(-X) |
Value unchanged OR safely clamped |
test_persistence_valid_config |
Ensure config values are loaded correctly |
Load from valid user://settings.cfg |
Runtime values match config |
test_persistence_missing_keys_fallback |
Verify fallback behavior for missing config fields |
Load config with missing keys |
Defaults applied for missing values |
test_persistence_invalid_types_fallback |
Ensure robustness against invalid config data |
Load config with wrong types |
Invalid values ignored; defaults used |
test_ui_updates_on_fuel_change_signal |
Validate UI reacts to fuel updates |
Bind UI element to fuel change signal |
UI reflects updated fuel value |
Fuel System Test Plan (GDUnit4)
This test plan validates the Fuel System behavior across core logic, edge cases, signals, persistence, and UI integration.
Scope Definition
Globals.gd, signal emissionAll time-based behavior must use deterministic delta simulation (no real-time dependency).
test_fuel_initializationfuel == max_capacitytest_fuel_consumption_static_exactdeltaover N steps using constant ratefuel == start - (rate * total_time)(within tolerance)test_fuel_consumption_with_scalingtest_fuel_not_negativefuel == 0.0(never negative)test_fuel_exact_zero_transition0.00.0test_fuel_depletion_signal_emitted_once>0 → 0fuel_depletedemitted once onlytest_multiple_depletion_signal_not_emitted_twicetest_refuel_basicfuel == previous + amounttest_refuel_clamped_to_maxfuel == max_capacitytest_refuel_negative_inputrefuel(-X)test_persistence_valid_configuser://settings.cfgtest_persistence_missing_keys_fallbacktest_persistence_invalid_types_fallbacktest_ui_updates_on_fuel_change_signalNotes
assert_almost_eq(..., tolerance)for float comparisonsdelta