|
13 | 13 | import static fj.data.List.*; |
14 | 14 | import static fj.data.Option.iif; |
15 | 15 | import static fj.data.Option.sequence; |
| 16 | +import static fj.data.Option.sequenceEither; |
| 17 | +import static fj.data.Option.sequenceEitherLeft; |
| 18 | +import static fj.data.Option.sequenceEitherRight; |
| 19 | +import static fj.data.Option.sequenceF; |
| 20 | +import static fj.data.Option.sequenceIO; |
| 21 | +import static fj.data.Option.sequenceList; |
| 22 | +import static fj.data.Option.sequenceOption; |
| 23 | +import static fj.data.Option.sequenceP1; |
| 24 | +import static fj.data.Option.sequenceSeq; |
| 25 | +import static fj.data.Option.sequenceSet; |
| 26 | +import static fj.data.Option.sequenceStream; |
| 27 | +import static fj.data.Option.sequenceTrampoline; |
| 28 | +import static fj.data.Option.sequenceValidation; |
16 | 29 | import static fj.data.Option.*; |
17 | 30 | import static fj.data.Validation.fail; |
18 | 31 | import static fj.data.Validation.*; |
@@ -226,6 +239,12 @@ public void testBindProduct8() { |
226 | 239 | }); |
227 | 240 | } |
228 | 241 |
|
| 242 | + @Test |
| 243 | + public void testSequenceEither() { |
| 244 | + assertEquals(right(none()), sequenceEither(none())); |
| 245 | + assertEquals(right(some("zero")), sequenceEither(some(right("zero")))); |
| 246 | + assertEquals(left("zero"), sequenceEither(some(left("zero")))); |
| 247 | + } |
229 | 248 |
|
230 | 249 | @Test |
231 | 250 | public void testSequenceEitherLeft() { |
@@ -311,6 +330,14 @@ public void testSequenceValidation() { |
311 | 330 | assertEquals(Validation.success(some(0)), sequenceValidation(some(Validation.success(0)))); |
312 | 331 | } |
313 | 332 |
|
| 333 | + @Test |
| 334 | + public void testTraverseEither() { |
| 335 | + assertEquals(right(none()), none().traverseEither(constant(right(0)))); |
| 336 | + assertEquals(right(some(0)), some("zero").traverseEither(constant(right(0)))); |
| 337 | + assertEquals(right(none()), none().traverseEither(constant(left(0)))); |
| 338 | + assertEquals(left(0), some("zero").traverseEither(constant(left(0)))); |
| 339 | + } |
| 340 | + |
314 | 341 | @Test |
315 | 342 | public void testTraverseEitherLeft() { |
316 | 343 | assertEquals(left(none()), none().traverseEitherLeft(constant(left(0)))); |
|
0 commit comments