Tighten static cargo and selection context proofs

This commit is contained in:
Jan Petykiewicz 2026-04-17 11:26:07 -07:00
commit b06abb24a7
12 changed files with 507 additions and 19 deletions

View file

@ -4238,6 +4238,41 @@ mod tests {
}
}
fn real_stock_prices_shell_row(
value: i32,
) -> crate::SmpLoadedPackedEventGroupedEffectRowSummary {
crate::SmpLoadedPackedEventGroupedEffectRowSummary {
group_index: 0,
row_index: 0,
descriptor_id: 55,
descriptor_label: Some("Stock Prices".to_string()),
target_mask_bits: Some(0x0b),
parameter_family: Some("company_finance_shell_scalar".to_string()),
grouped_target_subject: Some("company".to_string()),
grouped_target_scope: Some("selected_company".to_string()),
opcode: 3,
raw_scalar_value: value,
value_byte_0x09: 0,
value_dword_0x0d: 0,
value_byte_0x11: 0,
value_byte_0x12: 0,
value_word_0x14: 0,
value_word_0x16: 0,
row_shape: "scalar_assignment".to_string(),
semantic_family: Some("scalar_assignment".to_string()),
semantic_preview: Some(format!("Set Stock Prices to {value}")),
recovered_cargo_slot: None,
recovered_cargo_class: None,
recovered_cargo_label: None,
recovered_locomotive_id: None,
locomotive_name: None,
notes: vec![
"descriptor is recovered in the checked-in effect table as shell_owned parity"
.to_string(),
],
}
}
fn real_deactivate_player_row(
enabled: bool,
) -> crate::SmpLoadedPackedEventGroupedEffectRowSummary {
@ -7179,8 +7214,11 @@ mod tests {
standalone_condition_row_count: 0,
standalone_condition_rows: Vec::new(),
negative_sentinel_scope: None,
grouped_effect_row_counts: vec![1, 0, 0, 0],
grouped_effect_rows: vec![real_merger_premium_shell_row(25)],
grouped_effect_row_counts: vec![2, 0, 0, 0],
grouped_effect_rows: vec![
real_stock_prices_shell_row(120),
real_merger_premium_shell_row(25),
],
decoded_conditions: Vec::new(),
decoded_actions: Vec::new(),
executable_import_ready: false,
@ -8494,6 +8532,15 @@ mod tests {
.and_then(|summary| summary.records[0].import_outcome.as_deref()),
Some("blocked_evidence_blocked_descriptor")
);
assert_eq!(
import
.state
.packed_event_collection
.as_ref()
.and_then(|summary| summary.records[0].grouped_effect_rows.first())
.and_then(|row| row.descriptor_label.as_deref()),
Some("Named Cargo Price Slot 1")
);
}
#[test]