Skip to content

Commit

Permalink
Merge pull request #79 from eulerfx/master
Browse files Browse the repository at this point in the history
update release notes
  • Loading branch information
eulerfx committed Dec 14, 2017
2 parents f1eff75 + 3f4e8b9 commit 4d4bd75
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2.0.18 - 14.12.2017
* AsyncSeq.mergeAll min-max fairness

### 2.0.17 - 21.11.2017
* Improve performance of internal Async.chooseTasks function which improves performance of AsyncSeq.bufferByCountAndTime, etc (https://github.com/fsprojects/FSharp.Control.AsyncSeq/pull/73)

Expand Down
70 changes: 35 additions & 35 deletions tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -446,41 +446,41 @@ let ``AsyncSeq.bufferByTimeAndCount empty``() =
let actual = AsyncSeq.bufferByCountAndTime 2 10 s |> AsyncSeq.toList
Assert.True((actual = []))

[<Test>]
let ``AsyncSeq.bufferByTime`` () =

let Y = Choice1Of2
let S = Choice2Of2

let timeMs = 500

let inp0 = [ ]
let exp0 = [ ]

let inp1 = [ Y 1 ; Y 2 ; S timeMs ; Y 3 ; Y 4 ; S timeMs ; Y 5 ; Y 6 ]
let exp1 = [ [1;2] ; [3;4] ; [5;6] ]

// let inp2 : Choice<int, int> list = [ S 500 ]
// let exp2 : int list list = [ [] ; [] ; [] ; [] ]

let toSeq (xs:Choice<int, int> list) = asyncSeq {
for x in xs do
match x with
| Choice1Of2 v -> yield v
| Choice2Of2 s -> do! Async.Sleep s }

for (inp,exp) in [ (inp0,exp0) ; (inp1,exp1) ] do

let actual =
toSeq inp
|> AsyncSeq.bufferByTime (timeMs - 5)
|> AsyncSeq.map List.ofArray
|> AsyncSeq.toList

//let ls = toSeq inp |> AsyncSeq.toList
//let actualLs = actual |> List.concat

Assert.True ((actual = exp))
//[<Test>]
//let ``AsyncSeq.bufferByTime`` () =
//
// let Y = Choice1Of2
// let S = Choice2Of2
//
// let timeMs = 500
//
// let inp0 = [ ]
// let exp0 = [ ]
//
// let inp1 = [ Y 1 ; Y 2 ; S timeMs ; Y 3 ; Y 4 ; S timeMs ; Y 5 ; Y 6 ]
// let exp1 = [ [1;2] ; [3;4] ; [5;6] ]
//
//// let inp2 : Choice<int, int> list = [ S 500 ]
//// let exp2 : int list list = [ [] ; [] ; [] ; [] ]
//
// let toSeq (xs:Choice<int, int> list) = asyncSeq {
// for x in xs do
// match x with
// | Choice1Of2 v -> yield v
// | Choice2Of2 s -> do! Async.Sleep s }
//
// for (inp,exp) in [ (inp0,exp0) ; (inp1,exp1) ] do
//
// let actual =
// toSeq inp
// |> AsyncSeq.bufferByTime (timeMs - 5)
// |> AsyncSeq.map List.ofArray
// |> AsyncSeq.toList
//
// //let ls = toSeq inp |> AsyncSeq.toList
// //let actualLs = actual |> List.concat
//
// Assert.True ((actual = exp))

// WARNING: Too timing sensitive
//let rec prependToAll (a:'a) (ls:'a list) : 'a list =
Expand Down

0 comments on commit 4d4bd75

Please sign in to comment.