diff --git a/src/FSharpy.TaskSeq.Test/FSharpy.TaskSeq.Test.fsproj b/src/FSharpy.TaskSeq.Test/FSharpy.TaskSeq.Test.fsproj index e46e9dc9..2c20bd01 100644 --- a/src/FSharpy.TaskSeq.Test/FSharpy.TaskSeq.Test.fsproj +++ b/src/FSharpy.TaskSeq.Test/FSharpy.TaskSeq.Test.fsproj @@ -1,4 +1,4 @@ - + net6.0 @@ -18,13 +18,6 @@ - - - - - - - diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.Last.Tests.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.Last.Tests.fs deleted file mode 100644 index 8453457e..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.Last.Tests.fs +++ /dev/null @@ -1,57 +0,0 @@ -module FSharpy.Tests.Last - -open System -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy - - -[] -let ``TaskSeq-last throws on empty sequences`` () = task { - fun () -> TaskSeq.empty |> TaskSeq.last |> Task.ignore - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-last throws on empty sequences - variant`` () = task { - fun () -> taskSeq { do () } |> TaskSeq.last |> Task.ignore - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-tryLast returns None on empty sequences`` () = task { - let! nothing = TaskSeq.empty |> TaskSeq.tryLast - nothing |> should be None' -} - -[] -let ``TaskSeq-last gets the last item in a longer sequence`` () = task { - let! last = createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 |> TaskSeq.last - - last |> should equal 50 -} - -[] -let ``TaskSeq-last gets the only item in a singleton sequence`` () = task { - let! last = taskSeq { yield 10 } |> TaskSeq.last - last |> should equal 10 -} - -[] -let ``TaskSeq-tryLast gets the last item in a longer sequence`` () = task { - let! last = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryLast - - last |> should be Some' - last |> should equal (Some 50) -} - -[] -let ``TaskSeq-tryLast gets the only item in a singleton sequence`` () = task { - let! last = taskSeq { yield 10 } |> TaskSeq.tryLast - last |> should be Some' - last |> should equal (Some 10) -} diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.Map.Tests.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.Map.Tests.fs deleted file mode 100644 index 46dc1154..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.Map.Tests.fs +++ /dev/null @@ -1,34 +0,0 @@ -module FSharpy.Tests.Map - -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy - - -[] -let ``TaskSeq-map maps in correct order`` () = task { - let! sq = - createDummyTaskSeq 10 - |> TaskSeq.map (fun item -> char (item + 64)) - |> TaskSeq.toSeqCachedAsync - - sq - |> Seq.map string - |> String.concat "" - |> should equal "ABCDEFGHIJ" -} - -[] -let ``TaskSeq-mapAsync maps in correct order`` () = task { - let! sq = - createDummyTaskSeq 10 - |> TaskSeq.mapAsync (fun item -> task { return char (item + 64) }) - |> TaskSeq.toSeqCachedAsync - - sq - |> Seq.map string - |> String.concat "" - |> should equal "ABCDEFGHIJ" -} diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.OfXXX.Tests.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.OfXXX.Tests.fs deleted file mode 100644 index 0cb51387..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.OfXXX.Tests.fs +++ /dev/null @@ -1,57 +0,0 @@ -module FSharpy.Tests.``Conversion-From`` - -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy - -let validateSequence sq = task { - let! sq = TaskSeq.toArrayAsync sq - do sq |> Seq.toArray |> should equal [| 0..9 |] -} - -[] -let ``TaskSeq-ofAsyncArray should succeed`` () = - Array.init 10 (fun x -> async { return x }) - |> TaskSeq.ofAsyncArray - |> validateSequence - -[] -let ``TaskSeq-ofAsyncList should succeed`` () = - List.init 10 (fun x -> async { return x }) - |> TaskSeq.ofAsyncList - |> validateSequence - -[] -let ``TaskSeq-ofAsyncSeq should succeed`` () = - Seq.init 10 (fun x -> async { return x }) - |> TaskSeq.ofAsyncSeq - |> validateSequence - -[] -let ``TaskSeq-ofTaskArray should succeed`` () = - Array.init 10 (fun x -> task { return x }) - |> TaskSeq.ofTaskArray - |> validateSequence - -[] -let ``TaskSeq-ofTaskList should succeed`` () = - List.init 10 (fun x -> task { return x }) - |> TaskSeq.ofTaskList - |> validateSequence - -[] -let ``TaskSeq-ofTaskSeq should succeed`` () = - Seq.init 10 (fun x -> task { return x }) - |> TaskSeq.ofTaskSeq - |> validateSequence - -[] -let ``TaskSeq-ofArray should succeed`` () = Array.init 10 id |> TaskSeq.ofArray |> validateSequence - -[] -let ``TaskSeq-ofList should succeed`` () = List.init 10 id |> TaskSeq.ofList |> validateSequence - -[] -let ``TaskSeq-ofSeq should succeed`` () = Seq.init 10 id |> TaskSeq.ofSeq |> validateSequence diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.Pick.Tests.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.Pick.Tests.fs deleted file mode 100644 index 6e8c63de..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.Pick.Tests.fs +++ /dev/null @@ -1,258 +0,0 @@ -module FSharpy.Tests.Pick - -open System -open System.Collections.Generic -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy - - -// -// TaskSeq.pick -// TaskSeq.pickAsync -// the tryXXX versions are at the bottom half -// - -[] -let ``TaskSeq-pick on an empty sequence raises KeyNotFoundException`` () = task { - fun () -> - TaskSeq.empty - |> TaskSeq.pick (fun x -> if x = 12 then Some x else None) - |> Task.ignore - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pick on an empty sequence raises KeyNotFoundException - variant`` () = task { - fun () -> - taskSeq { do () } - |> TaskSeq.pick (fun x -> if x = 12 then Some x else None) - |> Task.ignore - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pickAsync on an empty sequence raises KeyNotFoundException`` () = task { - fun () -> - TaskSeq.empty - |> TaskSeq.pickAsync (fun x -> task { return if x = 12 then Some x else None }) - |> Task.ignore - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pick sad path raises KeyNotFoundException`` () = task { - fun () -> - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pick (fun x -> if x = 0 then Some x else None) // dummy tasks sequence starts at 1 - |> Task.ignore - - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pickAsync sad path raises KeyNotFoundException`` () = task { - fun () -> - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pickAsync (fun x -> task { return if x < 0 then Some x else None }) // dummy tasks sequence starts at 1 - |> Task.ignore - - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pick sad path raises KeyNotFoundException variant`` () = task { - fun () -> - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pick (fun x -> if x = 51 then Some x else None) // dummy tasks sequence ends at 50 - |> Task.ignore - - |> should throwAsyncExact typeof -} - -[] -let ``TaskSeq-pickAsync sad path raises KeyNotFoundException variant`` () = task { - fun () -> - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pickAsync (fun x -> task { return if x = 51 then Some x else None }) // dummy tasks sequence ends at 50 - |> Task.ignore - - |> should throwAsyncExact typeof -} - - -[] -let ``TaskSeq-pick happy path middle of seq`` () = task { - let! twentyFive = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pick (fun x -> if x < 26 && x > 24 then Some "foo" else None) - - twentyFive |> should equal "foo" -} - -[] -let ``TaskSeq-pickAsync happy path middle of seq`` () = task { - let! twentyFive = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pickAsync (fun x -> task { return if x < 26 && x > 24 then Some "foo" else None }) - - twentyFive |> should equal "foo" -} - -[] -let ``TaskSeq-pick happy path first item of seq`` () = task { - let! first = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pick (fun x -> if x = 1 then Some $"first{x}" else None) // dummy tasks seq starts at 1 - - first |> should equal "first1" -} - -[] -let ``TaskSeq-pickAsync happy path first item of seq`` () = task { - let! first = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pickAsync (fun x -> task { return if x = 1 then Some $"first{x}" else None }) // dummy tasks seq starts at 1 - - first |> should equal "first1" -} - -[] -let ``TaskSeq-pick happy path last item of seq`` () = task { - let! last = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pick (fun x -> if x = 50 then Some $"last{x}" else None) // dummy tasks seq ends at 50 - - last |> should equal "last50" -} - -[] -let ``TaskSeq-pickAsync happy path last item of seq`` () = task { - let! last = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.pickAsync (fun x -> task { return if x = 50 then Some $"last{x}" else None }) // dummy tasks seq ends at 50 - - last |> should equal "last50" -} - -// -// TaskSeq.tryPick -// TaskSeq.tryPickAsync -// - -[] -let ``TaskSeq-tryPick on an empty sequence returns None`` () = task { - let! nothing = - TaskSeq.empty - |> TaskSeq.tryPick (fun x -> if x = 12 then Some x else None) - - nothing |> should be None' -} - -[] -let ``TaskSeq-tryPickAsync on an empty sequence returns None`` () = task { - let! nothing = - TaskSeq.empty - |> TaskSeq.tryPickAsync (fun x -> task { return if x = 12 then Some x else None }) - - nothing |> should be None' -} - -[] -let ``TaskSeq-tryPick sad path returns None`` () = task { - let! nothing = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPick (fun x -> if x = 0 then Some x else None) // dummy tasks sequence starts at 1 - - nothing |> should be None' -} - -[] -let ``TaskSeq-tryPickAsync sad path return None`` () = task { - let! nothing = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPickAsync (fun x -> task { return if x = 0 then Some x else None }) // dummy tasks sequence starts at 1 - - nothing |> should be None' -} - -[] -let ``TaskSeq-tryPick sad path returns None variant`` () = task { - let! nothing = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPick (fun x -> if x >= 51 then Some x else None) // dummy tasks sequence ends at 50 (inverted sign in lambda!) - - nothing |> should be None' -} - -[] -let ``TaskSeq-tryPickAsync sad path return None - variant`` () = task { - let! nothing = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPickAsync (fun x -> task { return if x >= 51 then Some x else None }) // dummy tasks sequence ends at 50 - - nothing |> should be None' -} - - -[] -let ``TaskSeq-tryPick happy path middle of seq`` () = task { - let! twentyFive = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPick (fun x -> if x < 26 && x > 24 then Some $"foo{x}" else None) - - twentyFive |> should be Some' - twentyFive |> should equal (Some "foo25") -} - -[] -let ``TaskSeq-tryPickAsync happy path middle of seq`` () = task { - let! twentyFive = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPickAsync (fun x -> task { return if x < 26 && x > 24 then Some $"foo{x}" else None }) - - twentyFive |> should be Some' - twentyFive |> should equal (Some "foo25") -} - -[] -let ``TaskSeq-tryPick happy path first item of seq`` () = task { - let! first = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPick (sprintf "foo%i" >> Some) // dummy tasks seq starts at 1 - - first |> should be Some' - first |> should equal (Some "foo1") -} - -[] -let ``TaskSeq-tryPickAsync happy path first item of seq`` () = task { - let! first = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPickAsync (fun x -> task { return (sprintf "foo%i" >> Some) x }) // dummy tasks seq starts at 1 - - first |> should be Some' - first |> should equal (Some "foo1") -} - -[] -let ``TaskSeq-tryPick happy path last item of seq`` () = task { - let! last = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPick (fun x -> if x = 50 then Some $"foo{x}" else None) // dummy tasks seq ends at 50 - - last |> should be Some' - last |> should equal (Some "foo50") -} - -[] -let ``TaskSeq-tryPickAsync happy path last item of seq`` () = task { - let! last = - createDummyTaskSeqWith 50L<µs> 1000L<µs> 50 - |> TaskSeq.tryPickAsync (fun x -> task { return if x = 50 then Some $"foo{x}" else None }) // dummy tasks seq ends at 50 - - last |> should be Some' - last |> should equal (Some "foo50") -} diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.CE.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.CE.fs deleted file mode 100644 index a8d4a0dc..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.CE.fs +++ /dev/null @@ -1,218 +0,0 @@ -module FSharpy.Tests.``taskSeq Computation Expression`` - -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy -open System.Threading.Tasks -open System.Diagnostics - - -[] -let ``CE taskSeq with several yield!`` () = task { - let tskSeq = taskSeq { - yield! createDummyTaskSeq 10 - yield! createDummyTaskSeq 5 - yield! createDummyTaskSeq 10 - yield! createDummyTaskSeq 5 - } - - let! data = tskSeq |> TaskSeq.toListAsync - - data - |> should equal (List.concat [ [ 1..10 ]; [ 1..5 ]; [ 1..10 ]; [ 1..5 ] ]) -} - -[] -let ``CE taskSeq with nested yield!`` () = task { - let control = seq { - yield! [ 1..10 ] - - for i in 0..9 do - yield! [ 1..2 ] - - for i in 0..2 do - yield! seq { yield 42 } - - for i in 100..102 do - yield! seq { yield! seq { yield i } } - } - - let tskSeq = taskSeq { - yield! createDummyTaskSeq 10 - - for i in 0..9 do - yield! createDummyTaskSeq 2 - - for i in 0..2 do - yield! taskSeq { yield 42 } - - for i in 100..102 do - yield! taskSeq { yield! taskSeq { yield i } } - } - - let! data = tskSeq |> TaskSeq.toListAsync - - data |> should equal (List.ofSeq control) - data |> should haveLength 150 -} - -[] -let ``CE taskSeq with nested deeply yield! perf test 8521 nested tasks`` () = task { - let control = seq { - yield! [ 1..10 ] - - // original: - yield! Seq.concat <| Seq.init 4251 (fun _ -> [ 1; 2 ]) - //yield! Seq.concat <| Seq.init 120 (fun _ -> [ 1; 2 ]) - } - - let createTasks = createDummyTaskSeqWith 1L<µs> 10L<µs> - // FIXME: it appears that deeply nesting adds to performance degradation, need to benchmark/profile this - // probably cause: since this is *fast* with DirectTask, the reason is likely the way the Task.Delay causes - // *many* subtasks to be delayed, resulting in exponential delay. Reason: max accuracy of Delay is about 15ms (!) - - // RESOLUTION: seems to have been caused by erratic Task.Delay which has only a 15ms resolution - let tskSeq = taskSeq { - yield! createTasks 10 - - // nestings amount to 8512 sequences of [1;2] - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - for i in 0..2 do - yield! createTasks 2 - - yield! TaskSeq.empty - } - - let! data = tskSeq |> TaskSeq.toListAsync - data |> List.length |> should equal 8512 - data |> should equal (List.ofSeq control) -} - -[] -let ``CE taskSeq with several return!`` () = task { - // TODO: should we even support this? Traditional 'seq' doesn't. - let tskSeq = taskSeq { - return! createDummyTaskSeq 10 - return! createDummyTaskSeq 5 - } - - let! data = tskSeq |> TaskSeq.toListAsync - - // FIXME!!! This behavior is *probably* not correct - data |> should equal [ 1..10 ] -} - - -[] -let ``CE taskSeq with mixing yield! and yield`` () = task { - let tskSeq = taskSeq { - yield! createDummyTaskSeq 10 - yield 42 - yield! createDummyTaskSeq 5 - yield 42 - yield! createDummyTaskSeq 10 - yield 42 - yield! createDummyTaskSeq 5 - } - - let! data = tskSeq |> TaskSeq.toListAsync - - data - |> should equal (List.concat [ [ 1..10 ]; [ 42 ]; [ 1..5 ]; [ 42 ]; [ 1..10 ]; [ 42 ]; [ 1..5 ] ]) -} - -[] -let ``CE taskSeq: 1000 TaskDelay-delayed tasks using yield!`` () = task { - // Smoke performance test - // Runs in slightly over half a second (average of spin-wait, plus small overhead) - // should generally be about as fast as `task`, see below for equivalent test. - let tskSeq = taskSeq { yield! createDummyTaskSeqWith 50L<µs> 1000L<µs> 1000 } - let! data = tskSeq |> TaskSeq.toListAsync - data |> should equal [ 1..1000 ] -} - -[] -let ``CE taskSeq: 1000 sync-running tasks using yield!`` () = task { - // Smoke performance test - // Runs in a few 10's of ms, because of absense of Task.Delay - // should generally be about as fast as `task`, see below - let tskSeq = taskSeq { yield! createDummyDirectTaskSeq 1000 } - let! data = tskSeq |> TaskSeq.toListAsync - data |> should equal [ 1..1000 ] -} - -[] -let ``CE taskSeq: 5000 sync-running tasks using yield!`` () = task { - // Smoke performance test - // Compare with task-ce test below. Uses a no-delay hot-started sequence of tasks. - let tskSeq = taskSeq { yield! createDummyDirectTaskSeq 5000 } - let! data = tskSeq |> TaskSeq.toListAsync - data |> should equal [ 1..5000 ] -} - -[] -let ``CE task: 1000 TaskDelay-delayed tasks using for-loop`` () = task { - // Uses SpinWait for effective task-delaying - // for smoke-test comparison with taskSeq - let tasks = DummyTaskFactory(50L<µs>, 1000L<µs>).CreateDelayedTasks 1000 - let mutable i = 0 - - for t in tasks do - i <- i + 1 - do! t () |> Task.ignore - - i |> should equal 1000 -} - -[] -let ``CE task: 1000 list of sync-running tasks using for-loop`` () = task { - // runs in a few 10's of ms, because of absense of Task.Delay - // for smoke-test comparison with taskSeq - let tasks = DummyTaskFactory().CreateDirectTasks 1000 - let mutable i = 0 - - for t in tasks do - i <- i + 1 - do! t () |> Task.ignore - - i |> should equal 1000 -} - -[] -let ``CE task: 5000 list of sync-running tasks using for-loop`` () = task { - // runs in a few 100's of ms, because of absense of Task.Delay - // for smoke-test comparison with taskSeq - let tasks = DummyTaskFactory().CreateDirectTasks 5000 - let mutable i = 0 - - for t in tasks do - i <- i + 1 - do! t () |> Task.ignore - - i |> should equal 5000 -} diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.Other.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.Other.fs deleted file mode 100644 index bd0100f7..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.Tests.Other.fs +++ /dev/null @@ -1,27 +0,0 @@ -module FSharpy.Tests.``Other functions`` - -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy - - -[] -let ``TaskSeq-empty returns an empty sequence`` () = task { - let! sq = TaskSeq.empty |> TaskSeq.toSeqCachedAsync - Seq.isEmpty sq |> should be True - Seq.length sq |> should equal 0 -} - -[] -let ``TaskSeq-isEmpty returns true for empty`` () = task { - let! isEmpty = TaskSeq.empty |> TaskSeq.isEmpty - isEmpty |> should be True -} - -[] -let ``TaskSeq-isEmpty returns false for non-empty`` () = task { - let! isEmpty = taskSeq { yield 42 } |> TaskSeq.isEmpty - isEmpty |> should be False -} diff --git a/src/FSharpy.TaskSeq.Test/TaskSeq.ToXXX.Tests.fs b/src/FSharpy.TaskSeq.Test/TaskSeq.ToXXX.Tests.fs deleted file mode 100644 index 5d57feca..00000000 --- a/src/FSharpy.TaskSeq.Test/TaskSeq.ToXXX.Tests.fs +++ /dev/null @@ -1,74 +0,0 @@ -module FSharpy.Tests.``Conversion-To`` - -open Xunit -open FsUnit.Xunit -open FsToolkit.ErrorHandling - -open FSharpy -open System.Collections.Generic - -//////////////////////////////////////////////////////////////////////////// -/// /// -/// Notes for contributors: /// -/// /// -/// Conversion functions are expected to return a certain type /// -/// To prevent accidental change of signature, and because most /// -/// sequence-like functions can succeed tests interchangeably with /// -/// different sequence-like signatures, these tests /// -/// deliberately have a type annotation to prevent accidental changing /// -/// of the surface-area signatures. /// -/// /// -//////////////////////////////////////////////////////////////////////////// - -[] -let ``TaskSeq-toArrayAsync should succeed`` () = task { - let tq = createDummyTaskSeq 10 - let! (results: _[]) = tq |> TaskSeq.toArrayAsync - results |> should equal [| 1..10 |] -} - -[] -let ``TaskSeq-toListAsync should succeed`` () = task { - let tq = createDummyTaskSeq 10 - let! (results: list<_>) = tq |> TaskSeq.toListAsync - results |> should equal [ 1..10 ] -} - -[] -let ``TaskSeq-toSeqCachedAsync should succeed`` () = task { - let tq = createDummyTaskSeq 10 - let! (results: seq<_>) = tq |> TaskSeq.toSeqCachedAsync - results |> Seq.toArray |> should equal [| 1..10 |] -} - -[] -let ``TaskSeq-toIListAsync should succeed`` () = task { - let tq = createDummyTaskSeq 10 - let! (results: IList<_>) = tq |> TaskSeq.toIListAsync - results |> Seq.toArray |> should equal [| 1..10 |] -} - -[] -let ``TaskSeq-toResizeArray should succeed`` () = task { - let tq = createDummyTaskSeq 10 - let! (results: ResizeArray<_>) = tq |> TaskSeq.toResizeArrayAsync - results |> Seq.toArray |> should equal [| 1..10 |] -} - -[] -let ``TaskSeq-toArray should succeed and be blocking`` () = - let tq = createDummyTaskSeq 10 - let (results: _[]) = tq |> TaskSeq.toArray - results |> should equal [| 1..10 |] - -[] -let ``TaskSeq-toList should succeed and be blocking`` () = - let tq = createDummyTaskSeq 10 - let (results: list<_>) = tq |> TaskSeq.toList - results |> should equal [ 1..10 ] - -[] -let ``TaskSeq-toSeqCached should succeed and be blocking`` () = - let tq = createDummyTaskSeq 10 - let (results: seq<_>) = tq |> TaskSeq.toSeqCached - results |> Seq.toArray |> should equal [| 1..10 |]