let alpha = [| 'A' .. 'Z' |]
let alpha = [| 'A' ; 'Z' |]
let results = [| for i in 1 .. 64 -> square i |]
2D arrays as class members
type DemData ( width , height ) =
member this.Cells = Array2D.create width height NoHeight
Access array elements by index
input |> Seq.exists( fun c -> Char.IsLower c)
results |> Seq.sumBy( fun res -> extractValue res)
let usedRobotNames : Set < string > = Set.empty
let allChars = [ 'a' .. 'z' ] |> Set
Set.contains candidateName usedRobotNames
Set.isSubset smallerSet biggerSet
let mutable usedRobotNames : Set < string > = Set.empty
usedRobotNames <- Set.add chosenName usedRobotNames
let usedChars = Set.ofSeq input
|> Set.map ( Char.ToLower)
type FetchSrtmTiles = SrtmTileCoords seq -> SrtmTileHgtFile seq
type SrtmTileHgtFile = SrtmTileCoords * string
type Bounds = {
MinLon: double
MinLat: double
MaxLon: double
MaxLat: double
}
let bounds = {
MinLon = 10.1 ; MinLat = 20.1 ;
MaxLon = 10.2 ; MaxLat = 20.2
}
type NoHeight = NoHeight of unit
type SrtmTileHgtFile = SrtmTileHgtFile of SrtmTileCoords * string
SrtmTileHgtFile ( tileCoords, Path.Combine( localCacheDir, tileHgtFileName))
type Robot ( name : string ) =
member this.Name = name
match radius with
| r when r > 10.0 -> 0
| r when r > 5.0 -> 1
| r when r > 1.0 -> 5
| _ -> 10
Defining test fixture class and constructor
type ``PNG filtering property tests`` () =
do
Arb.register< ScanlinesGenerator>() |> ignore
|> should equal " N10W001"
stream |> should not' ( equal None)
demData |> should be ofExactType< DemData>
raises< InvalidOperationException>
<@
decodeSrtmTileFromPngFile FileSys.openFileToRead pngFileName
@>
Registering generators inside test fixture contructor
type ``PNG filtering property tests`` () =
do
Arb.register< ScanlinesGenerator>() |> ignore