< Summary

Information
Class: Minesweeper.MineFieldModule
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
92%
Covered lines: 12
Uncovered lines: 1
Coverable lines: 13
Total lines: 38
Line coverage: 92.3%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Method coverage is only available for sponsors.

Upgrade to PRO version

Coverage History

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
randoms(...)100%1100%
items(...)100%1100%
Invoke(...)100%1100%
Invoke(...)100%2100%
setup(...)50%266.66%

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
 8type 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 =
 1117        Seq.initInfinite(fun x -> RandomNumberGenerator.GetInt32(w * h))
 218        |> Seq.distinct
 219        |> Seq.take t
 220        |> Seq.toArray
 21
 22    let items x y =
 123        seq {0 .. x * y}
 6624        |> Seq.map (fun x -> Covered Zero)
 25
 26    let setup v =
 27        let itemsWithBomb items n =
 628            items |> Seq.updateAt n (Covered Bomb)
 29
 30        let itemsWithBombs w h b =
 131            let mutable ret = items w h
 932            for i in randoms w h b do
 33                ret <- itemsWithBomb ret i
 134            ret
 35
 136        match v with
 137        | Setup (w, h, b) -> Playing (w, h, (itemsWithBombs w h b))
 038        | x -> x