Skip to content

Commit 3d0704c

Browse files
test by with infinite generators
1 parent 4865ab6 commit 3d0704c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/src/base/by.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import test from 'ava' ;
22

3-
import {
4-
range ,
5-
by ,
6-
zip ,
7-
list } from '../../..' ;
8-
test( 'by' , t => {
3+
import { range , by , zip , list , count , head } from '../../..' ;
94

5+
test( 'by' , t => {
106

117
const A = by( range( 100 ) , 2 ) ;
128
const B = zip( range( 0 , 100 , 2 ) , range( 1 , 100 , 2 ) ) ;
@@ -23,3 +19,12 @@ test( 'by' , t => {
2319

2420
} ) ;
2521

22+
test( 'by (infinite sequences)' , t => {
23+
24+
const A = by( count( ) , 2 ) ;
25+
const B = zip( count( 0 , 2 ) , count( 1 , 2 ) ) ;
26+
27+
t.deepEqual( list( head( A , 1000 ) ) , list( head( B , 1000 ) ) , 'compare to zip output' ) ;
28+
29+
} ) ;
30+

0 commit comments

Comments
 (0)