Bridge packed event collection through save import
This commit is contained in:
parent
6ebe5fffeb
commit
83f55fa26e
13 changed files with 653 additions and 35 deletions
|
|
@ -4129,6 +4129,87 @@ mod tests {
|
|||
let _ = fs::remove_file(right_path);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diffs_runtime_states_with_packed_event_collection_changes() {
|
||||
let left = serde_json::json!({
|
||||
"format_version": 1,
|
||||
"snapshot_id": "left-packed-events",
|
||||
"state": {
|
||||
"calendar": {
|
||||
"year": 1830,
|
||||
"month_slot": 0,
|
||||
"phase_slot": 0,
|
||||
"tick_slot": 1
|
||||
},
|
||||
"world_flags": {},
|
||||
"companies": [],
|
||||
"packed_event_collection": {
|
||||
"source_kind": "packed-event-runtime-collection",
|
||||
"mechanism_family": "classic-save-rehydrate-v1",
|
||||
"mechanism_confidence": "grounded",
|
||||
"container_profile_family": "rt3-classic-save-container-v1",
|
||||
"packed_state_version": 1001,
|
||||
"packed_state_version_hex": "0x000003e9",
|
||||
"live_id_bound": 5,
|
||||
"live_record_count": 3,
|
||||
"live_entry_ids": [1, 3, 5]
|
||||
},
|
||||
"event_runtime_records": []
|
||||
}
|
||||
});
|
||||
let right = serde_json::json!({
|
||||
"format_version": 1,
|
||||
"snapshot_id": "right-packed-events",
|
||||
"state": {
|
||||
"calendar": {
|
||||
"year": 1830,
|
||||
"month_slot": 0,
|
||||
"phase_slot": 0,
|
||||
"tick_slot": 1
|
||||
},
|
||||
"world_flags": {},
|
||||
"companies": [],
|
||||
"packed_event_collection": {
|
||||
"source_kind": "packed-event-runtime-collection",
|
||||
"mechanism_family": "classic-save-rehydrate-v1",
|
||||
"mechanism_confidence": "grounded",
|
||||
"container_profile_family": "rt3-classic-save-container-v1",
|
||||
"packed_state_version": 1001,
|
||||
"packed_state_version_hex": "0x000003e9",
|
||||
"live_id_bound": 5,
|
||||
"live_record_count": 2,
|
||||
"live_entry_ids": [1, 5]
|
||||
},
|
||||
"event_runtime_records": []
|
||||
}
|
||||
});
|
||||
let left_path = write_temp_json("runtime-diff-packed-events-left", &left);
|
||||
let right_path = write_temp_json("runtime-diff-packed-events-right", &right);
|
||||
|
||||
let left_state =
|
||||
load_normalized_runtime_state(&left_path).expect("left runtime state should load");
|
||||
let right_state =
|
||||
load_normalized_runtime_state(&right_path).expect("right runtime state should load");
|
||||
let differences = diff_json_values(&left_state, &right_state);
|
||||
|
||||
assert!(differences.iter().any(|entry| {
|
||||
entry.path == "$.packed_event_collection.live_record_count"
|
||||
|| entry.path == "$.packed_event_collection.live_entry_ids[1]"
|
||||
}));
|
||||
|
||||
let _ = fs::remove_file(left_path);
|
||||
let _ = fs::remove_file(right_path);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn summarizes_snapshot_backed_fixture_with_packed_event_collection() {
|
||||
let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../../fixtures/runtime/packed-event-collection-from-snapshot.json");
|
||||
|
||||
run_runtime_summarize_fixture(&fixture_path)
|
||||
.expect("snapshot-backed packed-event fixture should summarize");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diffs_classic_profile_samples_across_multiple_files() {
|
||||
let sample_a = RuntimeClassicProfileSample {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue