tests: either limit alone changing is followed; only the target nobody could act for is told
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2eef1a85be
commit
2ef472f1f5
2 changed files with 29 additions and 0 deletions
|
|
@ -1095,6 +1095,25 @@ pub(crate) mod tests {
|
|||
assert!(!view.contains("Off-screen since"), "{view}");
|
||||
}
|
||||
|
||||
/// Only the target no one could act for is told: the gatehouse took its
|
||||
/// turn, the player's room had no one to give one.
|
||||
#[tokio::test]
|
||||
async fn only_the_target_nobody_could_act_for_is_told() {
|
||||
let fixture = Fixture::unwatched().await;
|
||||
let port = ScriptedPort::new(vec![speaks("w0", "The gate holds.")]);
|
||||
let (timelines, _stopped) = fixture.open(port.clone());
|
||||
let host = timelines.host(&fixture.id).await.unwrap();
|
||||
let world = host.world.snapshot().await.unwrap();
|
||||
let ids: Vec<String> = world.places.iter().map(|place| id_text(place.id)).collect();
|
||||
let mut doc = host.knobs.lock().await.current();
|
||||
doc.forced = knobs::run_world(&serde_json::json!({"targets": ids}).to_string(), &world).unwrap();
|
||||
host.knobs.lock().await.replace(doc).unwrap();
|
||||
run_waves(&host, 1).await;
|
||||
let wave = wave_of(&host, 1).await.unwrap();
|
||||
assert_eq!(wave.quiet, vec!["The Commons".to_owned()], "the gatehouse had a Warden");
|
||||
assert_eq!(wave.report.unwrap().nodes.len(), 1);
|
||||
}
|
||||
|
||||
/// A tune made while the window at the current revision is open binds it:
|
||||
/// the allowance that refused a wave is raised and the next wave at the
|
||||
/// same revision runs, spending what the ledger already held on top.
|
||||
|
|
|
|||
|
|
@ -555,6 +555,16 @@ async fn a_following_open_takes_new_limits_and_keeps_the_spend() {
|
|||
lowered.infer(prepared.clone()).await.expect_err("the lane is exhausted");
|
||||
assert_eq!(inner.calls(), 2);
|
||||
drop(lowered);
|
||||
// Either limit alone changing is followed too: the cap with the same lanes, the lanes with the same cap.
|
||||
let lane = |wave: u64, elaboration: u64| LaneTokens { wave, elaboration };
|
||||
let other = |cap: u64, lanes: LaneTokens| {
|
||||
RecordingInferencePort::open_following(inner.clone(), store.clone(), run.clone(), cap, lanes, &start())
|
||||
};
|
||||
drop(other(bound * 3, lane(bound / 2, bound / 2)).unwrap());
|
||||
drop(other(bound * 3, lane(bound, bound)).unwrap());
|
||||
drop(other(bound * 3, lane(bound, bound)).unwrap());
|
||||
assert_eq!(other(bound * 3, lane(bound, bound)).unwrap().cap(), bound * 3);
|
||||
drop(other(bound / 2, lanes(bound / 2)).unwrap());
|
||||
// The limits the ledger now holds are the followed ones: a plain open of them is accepted.
|
||||
drop(open(bound / 2, false).unwrap());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue