From: Ian Jackson Date: Wed, 14 Jul 2021 18:30:02 +0000 (+0100) Subject: wdt-simple: Allow "piece held by another player" as if it were conflict X-Git-Tag: otter-0.7.2~84 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9f9590030b0b56a785851884e0ba290e71f4c3da;p=otter.git 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 --- 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)?;