Closed adamklein closed 10 years ago
Here is the test. I have a working solution... soon!
[<Test>]
let ``Multiple conflicting range restrictions lead to empty results`` () =
let ls = DelayedSeries.Create(0, 100, fun _ _ -> async {
return seq { for i in 0 .. 100 -> KeyValue.Create(i, i) } })
ls.Between(90,89).KeyCount |> shouldEqual 0
I added the test cases that you mentioned in the earlier pull request and fixed the bug that was causing it (and I also added a test for the case that I suspected could be wrong, but was actually handled correctly).
The diff is here: https://github.com/tpetricek/Deedle/commit/f78b7d87f91e0f984c09293d0c71305e7c9971f1
And the updated pull request is: https://github.com/BlueMountainCapital/Deedle/pull/229
I will submit a test & fix shortly. In sum, the intersection of ranges (via
Between
) can include a[lo, hi]
pair with hi < lo, and then return a non-empty series because theflattenRanges
function inDelayedSeries.fs
sorts the boundaries without checking for this problem.