PageRenderTime 24ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/FingTest/TestUtil.fs

http://github.com/sandersn/fing
F# | 16 lines | 14 code | 1 blank | 1 comment | 0 complexity | 2ae3e5580e9727f4dff5ba36be127165 MD5 | raw file
 1´╗┐module Fing.TestUtil
 2open Util
 3open TestCases
 4open NUnit.Framework
 5// these are surprisingly easy to write and understand in their non-general tuple forms
 6let safezip l1 l2 = 
 7  let len = min (List.length l1) (List.length l2)
 8  Seq.zip (Seq.take len l1) (Seq.take len l2)
 9let sprints l = Seq.map (sprintf "%A") l |> String.concat ","
10let testall (results : seq<'a*'a>) =
11  Seq.iteri (fun i (exp,act) ->
12               Assert.AreEqual(exp :> obj,act :> obj, sprintf "%d. %A" i act))
13            results
14let testWith f pairs = Seq.map (second f) pairs |> testall
15let forallt f = testall (List.map f passresults)
16