File tree Expand file tree Collapse file tree
tests/FSharp.Collections.Immutable.Tests/Queue Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,16 +67,16 @@ type IQueueOptionTests () =
6767 let found : ( int * IQueue < int >) option = IQueue.tryUncons several
6868
6969 // A tuple compares an array by reference, so the first element and the other elements are compared apart
70- match found with
71- | Some ( head, tail) ->
72- Assert.AreEqual< int>( Array.head Inputs.Several, head, " Option.IQueue.tryUncons must return the first element" )
70+ let head , tail =
71+ Assert.WantSome ( found, " Option.IQueue.tryUncons must return the elements of a queue with elements" )
7372
74- CollectionAssert.AreEqual (
75- Array.tail Inputs.Several,
76- IQueue.toArray tail,
77- " Option.IQueue.tryUncons must return the other elements"
78- )
79- | None -> Assert.Fail " Option.IQueue.tryUncons must return the elements of a queue with elements"
73+ Assert.AreEqual< int>( Array.head Inputs.Several, head, " Option.IQueue.tryUncons must return the first element" )
74+
75+ CollectionAssert.AreEqual (
76+ Array.tail Inputs.Several,
77+ IQueue.toArray tail,
78+ " Option.IQueue.tryUncons must return the other elements"
79+ )
8080
8181 Assert.IsTrue (( IQueue.tryUncons empty) .IsNone, " Option.IQueue.tryUncons must return None for an empty queue" )
8282
Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ type IQueueTests () =
117117 static let sameElementType : Map < string , IQueue < int > -> IQueue < int >> =
118118 Map.ofArray [|
119119 nameof IQueue.tail, IQueue.tail
120- nameof IQueue.tryTail, ( fun queue -> ( IQueue.tryTail queue) .Value)
120+ nameof IQueue.tryTail,
121+ ( fun queue ->
122+ Assert.WantValueSome ( IQueue.tryTail queue, " IQueue.tryTail must return the tail of a queue with elements" )
123+ )
121124 ( nameof IQueue.uncons,
122125 fun queue ->
123126 let struct ( _ , tail ) = IQueue.uncons queue
Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ type IQueueTupleTests () =
2121 let found : ( int * IQueue < int >) voption = IQueue.tryUncons several
2222
2323 // A tuple compares an array by reference, so the first element and the other elements are compared apart
24- match found with
25- | ValueSome ( head, tail) ->
26- Assert.AreEqual< int>( Array.head Inputs.Several, head, " Tuple.IQueue.tryUncons must return the first element" )
24+ let head , tail =
25+ Assert.WantValueSome ( found, " Tuple.IQueue.tryUncons must return the elements of a queue with elements" )
2726
28- CollectionAssert.AreEqual (
29- Array.tail Inputs.Several,
30- IQueue.toArray tail,
31- " Tuple.IQueue.tryUncons must return the other elements"
32- )
33- | ValueNone -> Assert.Fail " Tuple.IQueue.tryUncons must return the elements of a queue with elements"
27+ Assert.AreEqual< int>( Array.head Inputs.Several, head, " Tuple.IQueue.tryUncons must return the first element" )
28+
29+ CollectionAssert.AreEqual (
30+ Array.tail Inputs.Several,
31+ IQueue.toArray tail,
32+ " Tuple.IQueue.tryUncons must return the other elements"
33+ )
3434
3535 [<TestMethod>]
3636 member _. ``uncons returns a reference tuple`` () =
Original file line number Diff line number Diff line change @@ -75,16 +75,16 @@ type QueueOptionTests () =
7575 let found : ( int * Queue < int >) option = Queue.tryUncons several
7676
7777 // A tuple compares an array by reference, so the first element and the other elements are compared apart
78- match found with
79- | Some ( head, tail) ->
80- Assert.AreEqual< int>( Array.head Inputs.Several, head, " Option.Queue.tryUncons must return the first element" )
78+ let head , tail =
79+ Assert.WantSome ( found, " Option.Queue.tryUncons must return the elements of a queue with elements" )
8180
82- CollectionAssert.AreEqual (
83- Array.tail Inputs.Several,
84- Queue.toArray tail,
85- " Option.Queue.tryUncons must return the other elements"
86- )
87- | None -> Assert.Fail " Option.Queue.tryUncons must return the elements of a queue with elements"
81+ Assert.AreEqual< int>( Array.head Inputs.Several, head, " Option.Queue.tryUncons must return the first element" )
82+
83+ CollectionAssert.AreEqual (
84+ Array.tail Inputs.Several,
85+ Queue.toArray tail,
86+ " Option.Queue.tryUncons must return the other elements"
87+ )
8888
8989 Assert.IsTrue (( Queue.tryUncons Queue.empty< int>) .IsNone, " Option.Queue.tryUncons must return None for an empty queue" )
9090
Original file line number Diff line number Diff line change @@ -607,15 +607,16 @@ type QueueTests () =
607607
608608 [<TestMethod>]
609609 member _. ``tryUncons returns the first element and the other elements or nothing`` () =
610- match Queue.tryUncons ( mixed ()) with
611- | ValueSome ( struct ( head, tail)) ->
612- Assert.AreEqual< int>( Array.head Inputs.Several, head, " Queue.tryUncons must return the first element" )
613- CollectionAssert.AreEqual (
614- Array.tail Inputs.Several,
615- Queue.toArray tail,
616- " Queue.tryUncons must return the other elements"
617- )
618- | ValueNone -> Assert.Fail " Queue.tryUncons must return the elements of a queue with elements"
610+ let struct ( head , tail ) =
611+ Assert.WantValueSome ( Queue.tryUncons ( mixed ()), " Queue.tryUncons must return the elements of a queue with elements" )
612+
613+ Assert.AreEqual< int>( Array.head Inputs.Several, head, " Queue.tryUncons must return the first element" )
614+
615+ CollectionAssert.AreEqual (
616+ Array.tail Inputs.Several,
617+ Queue.toArray tail,
618+ " Queue.tryUncons must return the other elements"
619+ )
619620
620621 Assert.IsTrue (( Queue.tryUncons Queue.empty< int>) .IsNone, " Queue.tryUncons of an empty queue must return nothing" )
621622
Original file line number Diff line number Diff line change @@ -32,16 +32,16 @@ type QueueTupleTests () =
3232 let found : ( int * Queue < int >) voption = Queue.tryUncons several
3333
3434 // A tuple compares an array by reference, so the first element and the other elements are compared apart
35- match found with
36- | ValueSome ( head, tail) ->
37- Assert.AreEqual< int>( Array.head Inputs.Several, head, " Tuple.Queue.tryUncons must return the first element" )
35+ let head , tail =
36+ Assert.WantValueSome ( found, " Tuple.Queue.tryUncons must return the elements of a queue with elements" )
3837
39- CollectionAssert.AreEqual (
40- Array.tail Inputs.Several,
41- Queue.toArray tail,
42- " Tuple.Queue.tryUncons must return the other elements"
43- )
44- | ValueNone -> Assert.Fail " Tuple.Queue.tryUncons must return the elements of a queue with elements"
38+ Assert.AreEqual< int>( Array.head Inputs.Several, head, " Tuple.Queue.tryUncons must return the first element" )
39+
40+ CollectionAssert.AreEqual (
41+ Array.tail Inputs.Several,
42+ Queue.toArray tail,
43+ " Tuple.Queue.tryUncons must return the other elements"
44+ )
4545
4646 [<TestMethod>]
4747 member _. ``uncons returns a reference tuple`` () =
You can’t perform that action at this time.
0 commit comments