< Summary

Information
Class: Minesweeper.MineField
Assembly: Minesweeper
File(s): /home/runner/work/poc-fsharp-tdd-kata-minesweeper1/poc-fsharp-tdd-kata-minesweeper1/src/Minesweeper/MineField.fs
Tag: 16_2290032055
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 38
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 7
Branch coverage: 0%
Method coverage

Method coverage is only available for sponsors.

Upgrade to PRO version

Coverage History

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
GetHashCode(...)0%70%

File(s)

/home/runner/work/poc-fsharp-tdd-kata-minesweeper1/poc-fsharp-tdd-kata-minesweeper1/src/Minesweeper/MineField.fs

#LineLine coverage
 1namespace Minesweeper
 2
 3open FSharpPlus.Data
 4open Microsoft.FSharp.Collections
 5open System
 6open System.Security.Cryptography
 7
 08type MineField =
 9   | Setup of width : int * height : int * bombs : int
 10   | Playing of width : int * height : int * seq<MineItem>
 11   | Win
 12   | Loose
 13
 14
 15module MineField =
 16    let randoms w h t =
 17        Seq.initInfinite(fun x -> RandomNumberGenerator.GetInt32(w * h))
 18        |> Seq.distinct
 19        |> Seq.take t
 20        |> Seq.toArray
 21
 22    let items x y =
 23        seq {0 .. x * y}
 24        |> Seq.map (fun x -> Covered Zero)
 25
 26    let setup v =
 27        let itemsWithBomb items n =
 28            items |> Seq.updateAt n (Covered Bomb)
 29
 30        let itemsWithBombs w h b =
 31            let mutable ret = items w h
 32            for i in randoms w h b do
 33                ret <- itemsWithBomb ret i
 34            ret
 35
 36        match v with
 37        | Setup (w, h, b) -> Playing (w, h, (itemsWithBombs w h b))
 38        | x -> x