Browse Source

Tests: rewrite a test to rely less on test tooling (regression?)

netstandard
Christoph Ruegg 10 years ago
parent
commit
563107424d
  1. 6
      src/FSharpUnitTests/FitTests.fs

6
src/FSharpUnitTests/FitTests.fs

@ -33,8 +33,10 @@ module FitTests =
let y = [| 4.986; 2.347; 2.061; -2.995; -2.352; -5.782 |]
// LeastSquares.FitToLinearCombination(x, y, (fun z -> 1.0), (fun z -> Math.Sin(z)), (fun z -> Math.Cos(z)))
(x,y) ||> Fit.linear [(fun _ -> 1.0); (Math.Sin); (Math.Cos) ]
|> should (equalWithin 1.0e-4) [ -0.287476; 4.02159; -1.46962 ]
let [a;b;c] = (x,y) ||> Fit.linear [(fun _ -> 1.0); (Math.Sin); (Math.Cos)]
a |> should (equalWithin 1.0e-4) -0.287476
b |> should (equalWithin 1.0e-4) 4.02159
c |> should (equalWithin 1.0e-4) -1.46962
let fres = Fit.linearFunc [(fun z -> 1.0); (fun z -> Math.Sin(z)); (fun z -> Math.Cos(z))] x y
in x |> Array.iter (fun x -> fres x |> should (equalWithin 1.0e-4) (4.02159*Math.Sin(x) - 1.46962*Math.Cos(x) - 0.287476))

Loading…
Cancel
Save