Skip to content

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

Open
@srpeterson

Description

@srpeterson

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions