@@ -30,37 +30,6 @@ var iterEmpty = require( '@stdlib/iter/empty' );
3030var iterMultiply = require ( './../lib' ) ;
3131
3232
33- // FUNCTIONS //
34-
35- function createIterator ( arr ) {
36- var len ;
37- var it ;
38- var i ;
39-
40- len = arr . length ;
41- i = - 1 ;
42-
43- it = { } ;
44- it . next = next ;
45-
46- return it ;
47-
48- function next ( ) {
49- var out ;
50- i += 1 ;
51- if ( i < len ) {
52- out = { } ;
53- out . value = arr [ i ] ;
54- out . done = ( i === len - 1 ) ;
55- return out ;
56- }
57- return {
58- 'done' : true
59- } ;
60- }
61- }
62-
63-
6433// TESTS //
6534
6635tape ( 'main export is a function' , function test ( t ) {
@@ -701,41 +670,6 @@ tape( 'the function returns an iterator protocol-compliant object which performs
701670 t . end ( ) ;
702671} ) ;
703672
704- tape ( 'the function returns an iterator protocol-compliant object which performs element-wise multiplication (value+done)' , function test ( t ) {
705- var expected ;
706- var values1 ;
707- var values2 ;
708- var actual ;
709- var it ;
710- var i ;
711-
712- values1 = [ 1.0 , 2.0 ] ;
713- values2 = [ 3.0 , 4.0 ] ;
714- expected = [
715- {
716- 'value' : 3.0 ,
717- 'done' : false
718- } ,
719- {
720- 'value' : 8.0 ,
721- 'done' : false
722- } ,
723- {
724- 'done' : true
725- }
726- ] ;
727-
728- it = iterMultiply ( createIterator ( values1 ) , createIterator ( values2 ) ) ;
729- t . equal ( it . next . length , 0 , 'has zero arity' ) ;
730-
731- actual = [ ] ;
732- for ( i = 0 ; i < expected . length ; i ++ ) {
733- actual . push ( it . next ( ) ) ;
734- }
735- t . deepEqual ( actual , expected , 'returns expected values' ) ;
736- t . end ( ) ;
737- } ) ;
738-
739673tape ( 'the function returns an iterator protocol-compliant object which returns `NaN` if an iterated value is non-numeric' , function test ( t ) {
740674 var expected ;
741675 var values1 ;
@@ -814,84 +748,6 @@ tape( 'the function returns an iterator protocol-compliant object which returns
814748 t . end ( ) ;
815749} ) ;
816750
817- tape ( 'the function returns an iterator protocol-compliant object which returns `NaN` if an iterated value is non-numeric (value+done)' , function test ( t ) {
818- var expected ;
819- var values1 ;
820- var values2 ;
821- var actual ;
822- var it ;
823- var i ;
824-
825- values1 = [ '1.0' , 2.0 ] ;
826- values2 = [ 3.0 , NaN ] ;
827- expected = [
828- {
829- 'value' : NaN ,
830- 'done' : false
831- } ,
832- {
833- 'value' : NaN ,
834- 'done' : false
835- } ,
836- {
837- 'done' : true
838- }
839- ] ;
840-
841- it = iterMultiply ( createIterator ( values1 ) , createIterator ( values2 ) ) ;
842- t . equal ( it . next . length , 0 , 'has zero arity' ) ;
843-
844- for ( i = 0 ; i < expected . length ; i ++ ) {
845- actual = it . next ( ) ;
846- if ( isnan ( expected [ i ] . value ) ) {
847- t . equal ( isnan ( actual . value ) , true , 'returns expected value' ) ;
848- } else {
849- t . equal ( actual . value , expected [ i ] . value , 'returns expected value' ) ;
850- }
851- t . equal ( actual . done , expected [ i ] . done , 'returns expected value' ) ;
852- }
853- t . end ( ) ;
854- } ) ;
855-
856- tape ( 'the function returns an iterator protocol-compliant object which returns `NaN` if an iterated value is non-numeric (value+done)' , function test ( t ) {
857- var expected ;
858- var values1 ;
859- var values2 ;
860- var actual ;
861- var it ;
862- var i ;
863-
864- values1 = [ 1.0 , '2.0' ] ;
865- values2 = [ NaN , 4.0 ] ;
866- expected = [
867- {
868- 'value' : NaN ,
869- 'done' : false
870- } ,
871- {
872- 'value' : NaN ,
873- 'done' : false
874- } ,
875- {
876- 'done' : true
877- }
878- ] ;
879-
880- it = iterMultiply ( createIterator ( values1 ) , createIterator ( values2 ) ) ;
881- t . equal ( it . next . length , 0 , 'has zero arity' ) ;
882-
883- for ( i = 0 ; i < expected . length ; i ++ ) {
884- actual = it . next ( ) ;
885- if ( isnan ( expected [ i ] . value ) ) {
886- t . equal ( isnan ( actual . value ) , true , 'returns expected value' ) ;
887- } else {
888- t . equal ( actual . value , expected [ i ] . value , 'returns expected value' ) ;
889- }
890- t . equal ( actual . done , expected [ i ] . done , 'returns expected value' ) ;
891- }
892- t . end ( ) ;
893- } ) ;
894-
895751tape ( 'the returned iterator has a `return` method for closing an iterator (no argument)' , function test ( t ) {
896752 var it ;
897753 var r ;
0 commit comments