Sha256: f97f7ab8f62323b28ff4516d4c0e69572ca1af5a54edfd6a0d00f05b85d575ce

Contents?: true

Size: 1.98 KB

Versions: 76

Compression:

Stored size: 1.98 KB

Contents

module GoCountingTest

open System

open Xunit
open FsUnit.Xunit

open GoCounting

let board5x5 =
    ["  B  ";
     " B B ";
     "B W B";
     " W W ";
     "  W  "]

let board9x9 =
    ["  B   B  ";
     "B   B   B";
     "WBBBWBBBW";
     "W W W W W";
     "         ";
     " W W W W ";
     "B B   B B";
     " W BBB W ";
     "   B B   "]

[<Fact>]
let ``5x5 territory for black`` () =
    let expected = Some (Some Black, [(0, 0); (0, 1); (1, 0)])
    territoryFor board5x5 (0, 1) |> should equal expected

[<Fact(Skip = "Remove to run test")>]
let ``5x5 territory for white`` () =
    let expected = Some (Some White, [(2, 3)])
    territoryFor board5x5 (2, 3) |> should equal expected

[<Fact(Skip = "Remove to run test")>]
let ``5x5 open territory`` () =
    let expected = Some ((None: Color option), [(0, 3); (0, 4); (1, 4)])
    territoryFor board5x5 (1, 4) |> should equal expected

[<Fact(Skip = "Remove to run test")>]
let ``5x5 non-territory (stone)`` () =
    territoryFor board5x5 (1, 1) |> should equal None

[<Fact(Skip = "Remove to run test")>]
let ``5x5 non-territory (too low coordinate)`` () =
    territoryFor board5x5 (-1, 1) |> should equal None

[<Fact(Skip = "Remove to run test")>]
let ``5x5 non-territory (too high coordinate)`` () =
    territoryFor board5x5 (1, 5) |> should equal None

[<Fact(Skip = "Remove to run test")>]
let ``Minimal board, no territories`` () =
    let input = ["B"]
    let expected = []

    territories input |> should be Empty

[<Fact(Skip = "Remove to run test")>]
let ``One territory, covering the whole board`` () =
    let input = [" "]
    let expected = [((None: Color option), [(0, 0)])] |> Map.ofList

    territories input |> should equal expected

[<Fact(Skip = "Remove to run test")>]
let ``Two territories, rectangular board`` () =
    let input = [" BW "; " BW "]
    let expected = [(Some Black, [(0, 0); (0, 1)]);
                    (Some White, [(3, 0); (3, 1)])]
                   |> Map.ofList

    territories input |> should equal expected

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.97 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.96 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.95 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.94 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.93 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.92 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.91 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.90 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.89 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.88 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.87 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.86 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.85 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.84 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.83 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.82 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.81 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.80 tracks/fsharp/exercises/go-counting/GoCountingTest.fs
trackler-2.2.1.79 tracks/fsharp/exercises/go-counting/GoCountingTest.fs