Skip to content

Commit 2fa5a64

Browse files
committed
add support for GoToSource
1 parent c072e6c commit 2fa5a64

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

docs/tools/generate.fsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ let info =
2020
// For typical project, no changes are needed below
2121
// --------------------------------------------------------------------------------------
2222

23-
#I "../../packages/FSharp.Formatting.2.2.11-beta/lib/net40"
23+
#I "../../packages/FSharp.Formatting.2.3.5-beta/lib/net40"
24+
#I "../../packages/FSharp.Compiler.Service.0.0.11-alpha/lib/net40"
2425
#I "../../packages/RazorEngine.3.3.0/lib/net40/"
2526
#r "../../packages/Microsoft.AspNet.Razor.2.0.30506.0/lib/net40/System.Web.Razor.dll"
2627
#r "../../packages/FAKE/tools/FakeLib.dll"
@@ -48,7 +49,7 @@ let content = __SOURCE_DIRECTORY__ @@ "../content"
4849
let output = __SOURCE_DIRECTORY__ @@ "../output"
4950
let files = __SOURCE_DIRECTORY__ @@ "../files"
5051
let templates = __SOURCE_DIRECTORY__ @@ "templates"
51-
let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting.2.2.11-beta/"
52+
let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting.2.3.5-beta/"
5253
let docTemplate = formatting @@ "templates/docpage.cshtml"
5354

5455
// Where to look for *.csproj templates (in this order)
@@ -69,7 +70,9 @@ let buildReference () =
6970
for lib in referenceBinaries do
7071
MetadataFormat.Generate
7172
( bin @@ lib, output @@ "reference", layoutRoots,
72-
parameters = ("root", root)::info )
73+
parameters = ("root", root)::info,
74+
sourceRepo = "https://github.com/fsprojects/ExcelFinancialFunctions/tree/master/src/",
75+
sourceFolder = @"..\..\src", publicOnly = true)
7376

7477
// Build documentation from `fsx` and `md` files in `docs/content`
7578
let buildDocumentation () =

docs/tools/packages.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="FSharp.Formatting" version="2.2.11-beta" targetFramework="net45" />
3+
<package id="FSharp.Formatting" version="2.3.5-beta" targetFramework="net45" />
4+
<package id="FSharp.Compiler.Service" version="0.0.11-alpha" targetFramework="net45" />
45
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
56
<package id="RazorEngine" version="3.3.0" targetFramework="net45" />
67
</packages>

docs/tools/templates/template.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@
5454
</div>
5555
</div>
5656
</div>
57-
<a href="@Properties["project-github"]"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
57+
<a href="@Properties["project-github"]"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
5858
</body>
5959
</html>

tests/ExcelFinancialFunctions.Tests/crosstests.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ module CrossTests =
159159

160160
[<Test>]
161161
let ``npv given irr should be zero``() =
162-
runTests "irr" (fun [| cfs; _; res |] ->
162+
runTests "npv(irr)" (fun [| cfs; _; res |] ->
163163
(parse res, parseArray cfs), 0.) Financial.Npv
164164

165165
[<Test>]

tests/ExcelFinancialFunctions.Tests/spottests.fs

+28
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,31 @@ module SpotTests =
5151
tryTBillPrice sd md disc
5252
==>
5353
lazy (Financial.TBillPrice(sd, md, disc) - 100. < PRECISION))
54+
55+
[<Test>]
56+
let ``vdb in the period should be the same as the sum by subperiods``() =
57+
fsCheck (fun c s len switchToStraightLine ->
58+
let start, life = 0., 10.
59+
let cost, salvage, period = toFloat c * 1000., toFloat s * 100., toFloat len
60+
let p1, p2 = period, period * 2.
61+
62+
tryVdb cost salvage life start p2 1. switchToStraightLine
63+
==>
64+
lazy (let inline vdb sd ed = Financial.Vdb(cost, salvage, life, sd, ed, 1., switchToStraightLine)
65+
abs (vdb start p1 + vdb p1 p2 - vdb start p2) < PRECISION))
66+
67+
[<Test>]
68+
let ``cumulative accrint should be the same as the sum of payments``() =
69+
fsCheck (fun (issue: DateTime) p r freq basis frac ->
70+
let par, rate = toFloat p * 1000000., toFloat r
71+
let fd, md = issue.AddDays 30., issue.AddYears 10
72+
let ncd = Financial.CoupNCD(fd, md, freq, basis)
73+
74+
tryAccrInt issue ncd fd rate par freq basis
75+
==>
76+
lazy (let inline accrint interest settlement =
77+
Financial.AccrInt(issue, interest, settlement, rate, par, freq, basis)
78+
79+
let daysTillInterest = max (360. / float freq * toFloat frac) 1.
80+
let interest = ncd.AddDays daysTillInterest
81+
abs (accrint ncd fd + accrint interest ncd - accrint interest fd) < PRECISION))

0 commit comments

Comments
 (0)