problem-specifications icon indicating copy to clipboard operation
problem-specifications copied to clipboard

Queen-Attack should have unit test to check if queens on same square

Open srpeterson opened this issue 5 years ago • 14 comments

Hi - I'm going through the F# track. In the Queen-Attack module I think there should be a unit test to check and see if 'canAttack' returns false if queen1 and queen2 are on the same square:

[<Fact>] let `Queens cannot attack if on same square`` () = let whiteQueen = (4, 4) let blackQueen = (4, 4) canAttack blackQueen whiteQueen |> should equal false

'canAttack' cannot assume that it will be passed two different values for queen1 and queen2. In real life two pieces cannot occupy the same square at the same time, so 'canAttack' should take into account this edge case, in my humble opinion!

srpeterson avatar Feb 17 '20 20:02 srpeterson