From 9f9590030b0b56a785851884e0ba290e71f4c3da Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 14 Jul 2021 19:30:02 +0100 Subject: [PATCH] wdt-simple: Allow "piece held by another player" as if it were conflict Regrab will allow us to try to grab the thing, not mind that it doesn't work, and then get this conflict. Signed-off-by: Ian Jackson --- wdriver/wdt-simple.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/wdriver/wdt-simple.rs b/wdriver/wdt-simple.rs index 5b641bb3..5263a418 100644 --- a/wdriver/wdt-simple.rs +++ b/wdriver/wdt-simple.rs @@ -250,9 +250,20 @@ impl Ctx { for got in &gots { let conflicts = got.log.find_conflicts(); - assert_eq!(conflicts.len(), - if got.yes { 0 } else { 1}, - "wrong # conflicts {:?}", &conflicts); + let helderrs = got.log.iter() + .filter(|m| m.contains("piece held by another player")) + .cloned().collect_vec(); + + dbg!( &conflicts, &helderrs ); + assert!( conflicts.len() <= 1 ); + assert!( helderrs .len() <= 1 ); + if got.yes { + assert_eq!( conflicts.len(), 0 ); + assert_eq!( helderrs .len(), 0 ); + } else { + assert!( conflicts.len() == 1 || + helderrs .len() == 1 ); + } } let mut yw = su.w(&y.window)?; -- 2.30.2