test(simulation): QA coverage for Phase 2 verbs, sprint suppression, occupancy, inventory
Add comprehensive test suites across sprint 6 systems: - Phase 2 observer filter: Confront injection, archetype label relabeling, contradiction marking, POI priority ordering (12 tests) - Sprint anomaly: detection during sprint, queue semantics, delay timing, D-055 visible-but-suppressed integration (7 tests) - Wire format: Confront and CharacterArchetype msgpack roundtrip (4 tests) - TilePresence: 4-layer coexistence on same tile (1 test) - Inventory: Take/Place full roundtrip, capacity enforcement (3 tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -506,3 +506,96 @@ fn all_object_type_variants_roundtrip() {
|
||||
assert_eq!(decoded, obj_type, "ObjectType::{:?} roundtrip failed", obj_type);
|
||||
}
|
||||
}
|
||||
|
||||
/// VerbKind::Confront (Phase 2, #422) must survive MessagePack round-trip.
|
||||
/// Guards against Confront being omitted from serde mapping.
|
||||
#[test]
|
||||
fn verb_kind_confront_roundtrip() {
|
||||
let mut snapshot = test_snapshot(0, vec![]);
|
||||
snapshot.nearby_interactions = vec![NearbyInteraction {
|
||||
entity_id: 1,
|
||||
entity_type: EntityKind::Npc,
|
||||
distance: 1,
|
||||
verbs: vec![VerbOption {
|
||||
kind: VerbKind::Confront,
|
||||
label: "Confront".into(),
|
||||
priority: 3,
|
||||
available: true,
|
||||
}],
|
||||
object_type: None,
|
||||
contradicted: false,
|
||||
}];
|
||||
|
||||
let bytes = rmp_serde::to_vec_named(&snapshot).expect("serialize");
|
||||
let decoded: ObserverSnapshot = rmp_serde::from_slice(&bytes).expect("deserialize");
|
||||
|
||||
assert_eq!(decoded.nearby_interactions.len(), 1);
|
||||
assert_eq!(decoded.nearby_interactions[0].verbs[0].kind, VerbKind::Confront);
|
||||
assert_eq!(decoded.nearby_interactions[0].verbs[0].label, "Confront");
|
||||
}
|
||||
|
||||
/// CharacterArchetype enum round-trips through MessagePack (#422).
|
||||
/// Used in Phase 2 label relabeling — must survive the wire.
|
||||
#[test]
|
||||
fn all_character_archetype_variants_roundtrip() {
|
||||
let archetypes = [
|
||||
CharacterArchetype::Smuggler,
|
||||
CharacterArchetype::Detective,
|
||||
];
|
||||
|
||||
for archetype in archetypes {
|
||||
let bytes = rmp_serde::to_vec_named(&archetype).expect("serialize");
|
||||
let decoded: CharacterArchetype = rmp_serde::from_slice(&bytes).expect("deserialize");
|
||||
assert_eq!(decoded, archetype, "CharacterArchetype::{:?} roundtrip failed", archetype);
|
||||
}
|
||||
}
|
||||
|
||||
/// NearbyInteraction.contradicted=true round-trips through MessagePack (#422).
|
||||
/// Guards the contradiction flag survives serialization.
|
||||
#[test]
|
||||
fn nearby_interaction_contradicted_roundtrip() {
|
||||
let mut snapshot = test_snapshot(0, vec![]);
|
||||
snapshot.nearby_interactions = vec![NearbyInteraction {
|
||||
entity_id: 1,
|
||||
entity_type: EntityKind::Npc,
|
||||
distance: 1,
|
||||
verbs: vec![VerbOption {
|
||||
kind: VerbKind::Talk,
|
||||
label: "Talk".into(),
|
||||
priority: 1,
|
||||
available: true,
|
||||
}],
|
||||
object_type: None,
|
||||
contradicted: true,
|
||||
}];
|
||||
|
||||
let bytes = rmp_serde::to_vec_named(&snapshot).expect("serialize");
|
||||
let decoded: ObserverSnapshot = rmp_serde::from_slice(&bytes).expect("deserialize");
|
||||
|
||||
assert!(decoded.nearby_interactions[0].contradicted, "contradicted flag should survive roundtrip");
|
||||
}
|
||||
|
||||
/// NearbyInteraction.object_type round-trips through MessagePack (#422).
|
||||
/// Verifies object_type=Some(Container) survives the wire.
|
||||
#[test]
|
||||
fn nearby_interaction_object_type_roundtrip() {
|
||||
let mut snapshot = test_snapshot(0, vec![]);
|
||||
snapshot.nearby_interactions = vec![NearbyInteraction {
|
||||
entity_id: 1,
|
||||
entity_type: EntityKind::Object,
|
||||
distance: 1,
|
||||
verbs: vec![VerbOption {
|
||||
kind: VerbKind::Open,
|
||||
label: "Open".into(),
|
||||
priority: 1,
|
||||
available: true,
|
||||
}],
|
||||
object_type: Some(ObjectType::Container),
|
||||
contradicted: false,
|
||||
}];
|
||||
|
||||
let bytes = rmp_serde::to_vec_named(&snapshot).expect("serialize");
|
||||
let decoded: ObserverSnapshot = rmp_serde::from_slice(&bytes).expect("deserialize");
|
||||
|
||||
assert_eq!(decoded.nearby_interactions[0].object_type, Some(ObjectType::Container));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user