Skip to content

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

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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