@@ -29,13 +29,13 @@ var acoversinBy = require( './../lib/main.js' );
2929
3030// VARIABLES //
3131
32- var rand = uniform ( 0.0 , 2.0 ) ;
32+ var rand = uniform ( 0.0 , 2.0 ) ;
3333
3434
3535// FUNCTIONS //
3636
37- function accessor ( v ) {
38- if ( v === void 0 ) {
37+ function accessor ( v ) {
38+ if ( v === void 0 ) {
3939 return ;
4040 }
4141 return v ;
@@ -44,18 +44,18 @@ function accessor( v ) {
4444
4545// TESTS //
4646
47- tape ( 'main export is a function' , function test ( t ) {
48- t . ok ( true , __filename ) ;
49- t . strictEqual ( typeof acoversinBy , 'function' , 'main export is a function' ) ;
47+ tape ( 'main export is a function' , function test ( t ) {
48+ t . ok ( true , __filename ) ;
49+ t . strictEqual ( typeof acoversinBy , 'function' , 'main export is a function' ) ;
5050 t . end ( ) ;
5151} ) ;
5252
53- tape ( 'the function has an arity of 7' , function test ( t ) {
54- t . strictEqual ( acoversinBy . length , 7 , 'arity of 7' ) ;
53+ tape ( 'the function has an arity of 7' , function test ( t ) {
54+ t . strictEqual ( acoversinBy . length , 7 , 'arity of 7' ) ;
5555 t . end ( ) ;
5656} ) ;
5757
58- tape ( 'the function computes the inverse coversed sine via a callback function' , function test ( t ) {
58+ tape ( 'the function computes the inverse coversed sine via a callback function' , function test ( t ) {
5959 var expected ;
6060 var x ;
6161 var y ;
@@ -65,37 +65,43 @@ tape( 'the function computes the inverse coversed sine via a callback function',
6565 y = [ ] ;
6666
6767 expected = [ ] ;
68- for ( i = 0 ; i < 10 ; i ++ ) {
69- x . push ( rand ( ) ) ;
70- y . push ( 0.0 ) ;
71- expected . push ( acoversin ( x [ i ] ) ) ;
68+ for ( i = 0 ; i < 10 ; i ++ ) {
69+ x . push ( rand ( ) ) ;
70+ y . push ( 0.0 ) ;
71+ expected . push ( acoversin ( x [ i ] ) ) ;
7272 }
7373
74- acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
75- t . deepEqual ( y , expected , 'deep equal' ) ;
74+ acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
75+ t . deepEqual ( y , expected , 'deep equal' ) ;
7676
77- x = new Array ( 5 ) ; // sparse array
78- y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
77+ x = [ ] ;
78+ for ( i = 0 ; i < 5 ; i ++ ) {
79+ x . push ( void 0 ) ;
80+ }
81+ y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
7982
80- expected = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
83+ expected = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
8184
82- acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
83- t . deepEqual ( y , expected , 'deep equal' ) ;
85+ acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
86+ t . deepEqual ( y , expected , 'deep equal' ) ;
8487
85- x = new Array ( 5 ) ; // sparse array
86- x [ 2 ] = rand ( ) ;
87- y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
88+ x = [ ] ;
89+ for ( i = 0 ; i < 5 ; i ++ ) {
90+ x . push ( void 0 ) ;
91+ }
92+ x [ 2 ] = rand ( ) ;
93+ y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
8894
8995 expected = y . slice ( ) ;
90- expected [ 2 ] = acoversin ( x [ 2 ] ) ;
96+ expected [ 2 ] = acoversin ( x [ 2 ] ) ;
9197
92- acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
93- t . deepEqual ( y , expected , 'deep equal' ) ;
98+ acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
99+ t . deepEqual ( y , expected , 'deep equal' ) ;
94100
95101 t . end ( ) ;
96102} ) ;
97103
98- tape ( 'the function supports an `x` stride' , function test ( t ) {
104+ tape ( 'the function supports an `x` stride' , function test ( t ) {
99105 var expected ;
100106 var x ;
101107 var y ;
@@ -117,21 +123,21 @@ tape( 'the function supports an `x` stride', function test( t ) {
117123 ] ;
118124 N = 3 ;
119125
120- acoversinBy ( N , x , 2 , y , 1 , accessor ) ;
126+ acoversinBy ( N , x , 2 , y , 1 , accessor ) ;
121127
122128 expected = [
123- acoversin ( x [ 0 ] ) ,
124- acoversin ( x [ 2 ] ) ,
125- acoversin ( x [ 4 ] ) ,
129+ acoversin ( x [ 0 ] ) ,
130+ acoversin ( x [ 2 ] ) ,
131+ acoversin ( x [ 4 ] ) ,
126132 0.0 ,
127133 0.0
128134 ] ;
129135
130- t . deepEqual ( y , expected , 'deep equal' ) ;
136+ t . deepEqual ( y , expected , 'deep equal' ) ;
131137 t . end ( ) ;
132138} ) ;
133139
134- tape ( 'the function supports a `y` stride' , function test ( t ) {
140+ tape ( 'the function supports a `y` stride' , function test ( t ) {
135141 var expected ;
136142 var x ;
137143 var y ;
@@ -153,54 +159,54 @@ tape( 'the function supports a `y` stride', function test( t ) {
153159 ] ;
154160 N = 3 ;
155161
156- acoversinBy ( N , x , 1 , y , 2 , accessor ) ;
162+ acoversinBy ( N , x , 1 , y , 2 , accessor ) ;
157163
158164 expected = [
159- acoversin ( x [ 0 ] ) ,
165+ acoversin ( x [ 0 ] ) ,
160166 0.0 ,
161- acoversin ( x [ 1 ] ) ,
167+ acoversin ( x [ 1 ] ) ,
162168 0.0 ,
163- acoversin ( x [ 2 ] )
169+ acoversin ( x [ 2 ] )
164170 ] ;
165171
166- t . deepEqual ( y , expected , 'deep equal' ) ;
172+ t . deepEqual ( y , expected , 'deep equal' ) ;
167173 t . end ( ) ;
168174} ) ;
169175
170- tape ( 'the function returns a reference to the destination array' , function test ( t ) {
176+ tape ( 'the function returns a reference to the destination array' , function test ( t ) {
171177 var out ;
172178 var x ;
173179 var y ;
174180
175- x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
176- y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
181+ x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
182+ y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
177183
178- out = acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
184+ out = acoversinBy ( x . length , x , 1 , y , 1 , accessor ) ;
179185
180- t . strictEqual ( out , y , 'same reference' ) ;
186+ t . strictEqual ( out , y , 'same reference' ) ;
181187 t . end ( ) ;
182188} ) ;
183189
184- tape ( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged' , function test ( t ) {
190+ tape ( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged' , function test ( t ) {
185191 var expected ;
186192 var x ;
187193 var y ;
188194
189- x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
190- y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
195+ x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
196+ y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
191197
192- expected = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
198+ expected = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
193199
194- acoversinBy ( - 1 , x , 1 , y , 1 , accessor ) ;
195- t . deepEqual ( y , expected , 'returns `y` unchanged' ) ;
200+ acoversinBy ( - 1 , x , 1 , y , 1 , accessor ) ;
201+ t . deepEqual ( y , expected , 'returns `y` unchanged' ) ;
196202
197- acoversinBy ( 0 , x , 1 , y , 1 , accessor ) ;
198- t . deepEqual ( y , expected , 'returns `y` unchanged' ) ;
203+ acoversinBy ( 0 , x , 1 , y , 1 , accessor ) ;
204+ t . deepEqual ( y , expected , 'returns `y` unchanged' ) ;
199205
200206 t . end ( ) ;
201207} ) ;
202208
203- tape ( 'the function supports negative strides' , function test ( t ) {
209+ tape ( 'the function supports negative strides' , function test ( t ) {
204210 var expected ;
205211 var x ;
206212 var y ;
@@ -222,21 +228,21 @@ tape( 'the function supports negative strides', function test( t ) {
222228 ] ;
223229 N = 3 ;
224230
225- acoversinBy ( N , x , - 2 , y , - 1 , accessor ) ;
231+ acoversinBy ( N , x , - 2 , y , - 1 , accessor ) ;
226232
227233 expected = [
228- acoversin ( x [ 0 ] ) ,
229- acoversin ( x [ 2 ] ) ,
230- acoversin ( x [ 4 ] ) ,
234+ acoversin ( x [ 0 ] ) ,
235+ acoversin ( x [ 2 ] ) ,
236+ acoversin ( x [ 4 ] ) ,
231237 0.0 ,
232238 0.0
233239 ] ;
234240
235- t . deepEqual ( y , expected , 'deep equal' ) ;
241+ t . deepEqual ( y , expected , 'deep equal' ) ;
236242 t . end ( ) ;
237243} ) ;
238244
239- tape ( 'the function supports complex access patterns' , function test ( t ) {
245+ tape ( 'the function supports complex access patterns' , function test ( t ) {
240246 var expected ;
241247 var x ;
242248 var y ;
@@ -260,22 +266,22 @@ tape( 'the function supports complex access patterns', function test( t ) {
260266 ] ;
261267 N = 3 ;
262268
263- acoversinBy ( N , x , 2 , y , - 1 , accessor ) ;
269+ acoversinBy ( N , x , 2 , y , - 1 , accessor ) ;
264270
265271 expected = [
266- acoversin ( x [ 4 ] ) ,
267- acoversin ( x [ 2 ] ) ,
268- acoversin ( x [ 0 ] ) ,
272+ acoversin ( x [ 4 ] ) ,
273+ acoversin ( x [ 2 ] ) ,
274+ acoversin ( x [ 0 ] ) ,
269275 0.0 ,
270276 0.0 ,
271277 0.0
272278 ] ;
273279
274- t . deepEqual ( y , expected , 'deep equal' ) ;
280+ t . deepEqual ( y , expected , 'deep equal' ) ;
275281 t . end ( ) ;
276282} ) ;
277283
278- tape ( 'the function supports view offsets' , function test ( t ) {
284+ tape ( 'the function supports view offsets' , function test ( t ) {
279285 var expected ;
280286 var x0 ;
281287 var y0 ;
@@ -302,41 +308,41 @@ tape( 'the function supports view offsets', function test( t ) {
302308 ] ) ;
303309
304310 // Create offset views...
305- x1 = new Float64Array ( x0 . buffer , x0 . BYTES_PER_ELEMENT * 1 ) ; // begin at 2nd element
306- y1 = new Float64Array ( y0 . buffer , y0 . BYTES_PER_ELEMENT * 3 ) ; // begin at the 4th element
311+ x1 = new Float64Array ( x0 . buffer , x0 . BYTES_PER_ELEMENT * 1 ) ; // begin at 2nd element
312+ y1 = new Float64Array ( y0 . buffer , y0 . BYTES_PER_ELEMENT * 3 ) ; // begin at the 4th element
307313
308314 N = 3 ;
309315
310- acoversinBy ( N , x1 , - 2 , y1 , 1 , accessor ) ;
316+ acoversinBy ( N , x1 , - 2 , y1 , 1 , accessor ) ;
311317 expected = new Float64Array ( [
312318 0.0 ,
313319 0.0 ,
314320 0.0 ,
315- acoversin ( x0 [ 5 ] ) ,
316- acoversin ( x0 [ 3 ] ) ,
317- acoversin ( x0 [ 1 ] )
321+ acoversin ( x0 [ 5 ] ) ,
322+ acoversin ( x0 [ 3 ] ) ,
323+ acoversin ( x0 [ 1 ] )
318324 ] ) ;
319325
320- t . deepEqual ( y0 , expected , 'deep equal' ) ;
326+ t . deepEqual ( y0 , expected , 'deep equal' ) ;
321327 t . end ( ) ;
322328} ) ;
323329
324- tape ( 'the function supports providing a callback execution context' , function test ( t ) {
330+ tape ( 'the function supports providing a callback execution context' , function test ( t ) {
325331 var ctx ;
326332 var x ;
327333 var y ;
328334
329- x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
330- y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
335+ x = [ rand ( ) , rand ( ) , rand ( ) , rand ( ) , rand ( ) ] ;
336+ y = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] ;
331337 ctx = {
332338 'count' : 0
333339 } ;
334- acoversinBy ( x . length , x , 1 , y , 1 , accessor , ctx ) ;
340+ acoversinBy ( x . length , x , 1 , y , 1 , accessor , ctx ) ;
335341
336- t . strictEqual ( ctx . count , x . length , 'returns expected value' ) ;
342+ t . strictEqual ( ctx . count , x . length , 'returns expected value' ) ;
337343 t . end ( ) ;
338344
339- function accessor ( v ) {
345+ function accessor ( v ) {
340346 this . count += 1 ; // eslint-disable-line no-invalid-this
341347 return v ;
342348 }
0 commit comments