-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTaskSeq.Choose.Tests.fs
More file actions
75 lines (56 loc) · 2.01 KB
/
TaskSeq.Choose.Tests.fs
File metadata and controls
75 lines (56 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
namespace FSharpy.Tests
open System
open System.Threading.Tasks
open Xunit
open FsUnit.Xunit
open FsToolkit.ErrorHandling
open FSharpy
open Xunit.Abstractions
type Choose(output: ITestOutputHelper) =
[<Fact(Skip = "CI test runner chokes!")>]
let ``ZHang timeout test`` () =
logStart output
task {
let! empty = Task.Delay 30
empty |> should be Null
}
[<Fact(Skip = "CI test runner chokes!")>]
let ``TaskSeq-choose on an empty sequence`` () =
logStart output
task {
let! empty =
TaskSeq.empty
|> TaskSeq.choose (fun _ -> Some 42)
|> TaskSeq.toListAsync
List.isEmpty empty |> should be True
}
[<Fact(Skip = "CI test runner chokes!")>]
let ``TaskSeq-chooseAsync on an empty sequence`` () =
logStart output
task {
let! empty =
TaskSeq.empty
|> TaskSeq.chooseAsync (fun _ -> task { return Some 42 })
|> TaskSeq.toListAsync
List.isEmpty empty |> should be True
}
[<Fact(Skip = "CI test runner chokes!")>]
let ``TaskSeq-choose can convert and filter`` () =
logStart output
task {
let! alphabet =
createDummyTaskSeqWith 50L<µs> 1000L<µs> 50
|> TaskSeq.choose (fun number -> if number <= 26 then Some(char number + '@') else None)
|> TaskSeq.toArrayAsync
String alphabet |> should equal "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}
[<Fact(Skip = "CI test runner chokes!")>]
let ``TaskSeq-chooseAsync can convert and filter`` () =
logStart output
task {
let! alphabet =
createDummyTaskSeqWith 50L<µs> 1000L<µs> 50
|> TaskSeq.choose (fun number -> if number <= 26 then Some(char number + '@') else None)
|> TaskSeq.toArrayAsync
String alphabet |> should equal "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}