1
exercism fetch fsharp queen-attack

QueenAttackTest.fs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// This file was auto-generated based on version 2.0.0 of the canonical data.

module QueenAttackTest

open FsUnit.Xunit
open Xunit

open QueenAttack

[<Fact>]
let ``Queen with a valid position`` () =
    create (2, 2) |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Queen must have positive row`` () =
    create (-2, 2) |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Queen must have row on board`` () =
    create (8, 4) |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Queen must have positive column`` () =
    create (2, -2) |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Queen must have column on board`` () =
    create (4, 8) |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Can not attack`` () =
    let whiteQueen = (2, 4)
    let blackQueen = (6, 6)
    canAttack blackQueen whiteQueen |> should equal false

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on same row`` () =
    let whiteQueen = (2, 4)
    let blackQueen = (2, 6)
    canAttack blackQueen whiteQueen |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on same column`` () =
    let whiteQueen = (4, 5)
    let blackQueen = (2, 5)
    canAttack blackQueen whiteQueen |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on first diagonal`` () =
    let whiteQueen = (2, 2)
    let blackQueen = (0, 4)
    canAttack blackQueen whiteQueen |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on second diagonal`` () =
    let whiteQueen = (2, 2)
    let blackQueen = (3, 1)
    canAttack blackQueen whiteQueen |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on third diagonal`` () =
    let whiteQueen = (2, 2)
    let blackQueen = (1, 1)
    canAttack blackQueen whiteQueen |> should equal true

[<Fact(Skip = "Remove to run test")>]
let ``Can attack on fourth diagonal`` () =
    let whiteQueen = (2, 2)
    let blackQueen = (5, 5)
    canAttack blackQueen whiteQueen |> should equal true