Skip to content

Commit 460b7f7

Browse files
T-GroKevinRansom
authored andcommitted
Simplified regression test case
1 parent 5cbffd0 commit 460b7f7

File tree

2 files changed

+81
-881
lines changed

2 files changed

+81
-881
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,31 @@
11
open System
22
open System.Diagnostics
33

4-
// 16 byte struct
5-
[<Struct>]
6-
type Point2D(x: double, y: double) =
7-
member _.X = x
8-
member _.Y = y
94

105
// Will create a tail il instruction and force a tail call. This is will become
116
// a fast tail call on unix x64 as the caller and callee have equal stack size
127
let fifth() =
13-
let rec fifthMethodFirstCallee(iterationCount, firstArg: Point2D, secondArg: Point2D, thirdArg: Point2D, fourthArg: Point2D, fifthArg: Point2D) =
14-
if firstArg.X <> 10.0 then -100
15-
else if firstArg.Y <> 20.0 then -101
16-
else if secondArg.X <> 30.0 then -102
17-
else if secondArg.Y <> 40.0 then -103
18-
else if thirdArg.X <> 10.0 then -104
19-
else if thirdArg.Y <> 20.0 then -105
20-
else if fourthArg.X <> 30.0 then -106
21-
else if fourthArg.Y <> 40.0 then -107
22-
else if fifthArg.X <> 10.0 then -108
23-
else if fifthArg.Y <> 20.0 then -109
24-
else if iterationCount = 0 then
8+
let rec fifthMethodFirstCallee(iterationCount, firstArg: int) =
9+
if iterationCount = 0 then
2510
100
2611
else if iterationCount % 2 = 0 then
27-
fifthMethodSecondCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg)
12+
fifthMethodSecondCallee(iterationCount - 1, firstArg)
2813
else
29-
fifthMethodFirstCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg)
14+
fifthMethodFirstCallee(iterationCount - 1, firstArg)
3015

31-
and fifthMethodSecondCallee(iterationCount, firstArg, secondArg, thirdArg, fourthArg, fifthArg) =
32-
if firstArg.X <> 10.0 then -150
33-
else if firstArg.Y <> 20.0 then -151
34-
else if secondArg.X <> 30.0 then -152
35-
else if secondArg.Y <> 40.0 then -153
36-
else if thirdArg.X <> 10.0 then -154
37-
else if thirdArg.Y <> 20.0 then -155
38-
else if fourthArg.X <> 30.0 then -156
39-
else if fourthArg.Y <> 40.0 then -157
40-
else if fifthArg.X <> 10.0 then -158
41-
else if fifthArg.Y <> 20.0 then -159
42-
else if iterationCount = 0 then
16+
and fifthMethodSecondCallee(iterationCount, firstArg) =
17+
if iterationCount = 0 then
4318
101
4419
else if iterationCount % 2 = 0 then
45-
fifthMethodSecondCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg)
20+
fifthMethodSecondCallee(iterationCount - 1, firstArg)
4621
else
47-
fifthMethodFirstCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg)
22+
fifthMethodFirstCallee(iterationCount - 1, firstArg)
4823

49-
let point = Point2D(10.0, 20.0)
50-
let secondPoint = Point2D(30.0, 40.0)
5124

52-
let retVal = fifthMethodFirstCallee(1000000, point, secondPoint, point, secondPoint, point)
5325

54-
if retVal <> 100 && retVal <> 101 then
55-
printfn "Method -- Failed, expected result: 100 or 101, calculated: %d" retVal
56-
-5
57-
else
58-
0
26+
fifthMethodFirstCallee(1000000, 158_423)
27+
5928

6029
[<EntryPoint>]
6130
let main argv =
62-
let startTime = Stopwatch.StartNew()
63-
for i in 0..100 do
64-
ignore (fifth ())
65-
let elapsedTime = startTime.Elapsed.TotalMilliseconds
66-
printfn "%fms" elapsedTime
67-
0
31+
fifth ()

0 commit comments

Comments
 (0)