9181c264689647c65406a9c833d0244e92845d20
1
namespace ParasitemiaCore.Tests
4 open Xunit.Abstractions
6 open ParasitemiaCore.KdTree
8 type Point (x
: float32
, y
: float32
) =
9 interface I2DCoords with
13 override this.ToString () =
14 sprintf
"(%.1f, %.1f)" x y
16 type KdTreeTests (output
: ITestOutputHelper) =
18 // TODO: test with identical X or Y coords
32 let tree = Tree.BuildTree pts
33 output
.WriteLine (sprintf
"Tree: %A" tree)
35 let s1 = tree.Search { minX
= 0.0f; maxX
= 5.0f; minY
= 0.0f; maxY
= 5.0f } // All points.
36 output
.WriteLine (sprintf
"s1: %A" s1)
38 let s2 = tree.Search { minX
= 2.8f; maxX
= 4.5f; minY
= 3.0f; maxY
= 4.5f }
39 output
.WriteLine (sprintf
"s2: %A" s2)
41 let s3 = tree.Search { minX
= 2.0f; maxX
= 2.0f; minY
= 2.0f; maxY
= 2.0f }
42 output
.WriteLine (sprintf
"s3: %A" s3)
45 member this.test2
() =
53 let tree = Tree.BuildTree pts
54 output
.WriteLine (sprintf
"Tree: %A" tree)
56 let s1 = tree.Search { minX
= 1.0f; maxX
= 1.0f; minY
= 1.0f; maxY
= 1.0f }
57 output
.WriteLine (sprintf
"s1: %A" s1)
59 let s2 = tree.Search { minX
= 1.0f; maxX
= 1.0f; minY
= 2.0f; maxY
= 2.0f }
60 output
.WriteLine (sprintf
"s2: %A" s2)
62 // This case result is wrong: FIXME
63 let s3 = tree.Search { minX
= 1.0f; maxX
= 1.0f; minY
= 3.0f; maxY
= 3.0f }
64 output
.WriteLine (sprintf
"s3: %A" s3)
66 let s4 = tree.Search { minX
= 0.0f; maxX
= 2.0f; minY
= 0.0f; maxY
= 4.0f }
67 output
.WriteLine (sprintf
"s4: %A" s4)