Skip to content

Commit e693161

Browse files
committed
test: fix test comparisons
1 parent 562f806 commit e693161

File tree

2 files changed

+15
-57
lines changed

2 files changed

+15
-57
lines changed

lib/node_modules/@stdlib/blas/base/zaxpy/test/test.ndarray.js

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ tape( 'the function scales elements from `zx` by `za` and adds the result to `zy
7777
var za;
7878
var zx;
7979
var zy;
80-
var k;
8180

8281
zx = new Complex128Array( [
8382
0.7, // 1
@@ -132,9 +131,7 @@ tape( 'the function scales elements from `zx` by `za` and adds the result to `zy
132131
0.8,
133132
-0.7
134133
] );
135-
for ( k = 0; k < expected.length; k++ ) {
136-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
137-
}
134+
isApprox( t, viewY, expected, 14.0 );
138135
t.end();
139136
});
140137

@@ -144,7 +141,6 @@ tape( 'the function supports a `zx` stride', function test( t ) {
144141
var za;
145142
var zx;
146143
var zy;
147-
var k;
148144

149145
zx = new Complex128Array( [
150146
0.7, // 1
@@ -199,9 +195,7 @@ tape( 'the function supports a `zx` stride', function test( t ) {
199195
0.8,
200196
-0.7
201197
] );
202-
for ( k = 0; k < expected.length; k++ ) {
203-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
204-
}
198+
isApprox( t, viewY, expected, 14.0 );
205199
t.end();
206200
});
207201

@@ -211,7 +205,6 @@ tape( 'the function supports a `zx` offset', function test( t ) {
211205
var za;
212206
var zx;
213207
var zy;
214-
var k;
215208

216209
zx = new Complex128Array( [
217210
0.7,
@@ -266,9 +259,7 @@ tape( 'the function supports a `zx` offset', function test( t ) {
266259
0.8,
267260
-0.7
268261
] );
269-
for ( k = 0; k < expected.length; k++ ) {
270-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
271-
}
262+
isApprox( t, viewY, expected, 14.0 );
272263
t.end();
273264
});
274265

@@ -278,7 +269,6 @@ tape( 'the function supports a `zy` stride', function test( t ) {
278269
var za;
279270
var zx;
280271
var zy;
281-
var k;
282272

283273
zx = new Complex128Array( [
284274
0.7, // 1
@@ -333,9 +323,7 @@ tape( 'the function supports a `zy` stride', function test( t ) {
333323
0.32, // 4
334324
-1.16 // 4
335325
] );
336-
for ( k = 0; k < expected.length; k++ ) {
337-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
338-
}
326+
isApprox( t, viewY, expected, 14.0 );
339327
t.end();
340328
});
341329

@@ -345,7 +333,6 @@ tape( 'the function supports a `zy` offset', function test( t ) {
345333
var za;
346334
var zx;
347335
var zy;
348-
var k;
349336

350337
zx = new Complex128Array( [
351338
0.7, // 1
@@ -400,9 +387,7 @@ tape( 'the function supports a `zy` offset', function test( t ) {
400387
0.8,
401388
-0.7
402389
] );
403-
for ( k = 0; k < expected.length; k++ ) {
404-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
405-
}
390+
isApprox( t, viewY, expected, 14.0 );
406391
t.end();
407392
});
408393

@@ -451,7 +436,6 @@ tape( 'the function supports a negative `zx` stride', function test( t ) {
451436
var za;
452437
var zx;
453438
var zy;
454-
var k;
455439

456440
zx = new Complex128Array( [
457441
0.7, // 4
@@ -506,9 +490,7 @@ tape( 'the function supports a negative `zx` stride', function test( t ) {
506490
0.8,
507491
-0.7
508492
] );
509-
for ( k = 0; k < expected.length; k++ ) {
510-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
511-
}
493+
isApprox( t, viewY, expected, 14.0 );
512494
t.end();
513495
});
514496

@@ -518,7 +500,6 @@ tape( 'the function supports a negative `zy` stride', function test( t ) {
518500
var za;
519501
var zx;
520502
var zy;
521-
var k;
522503

523504
zx = new Complex128Array( [
524505
0.7, // 1
@@ -573,9 +554,7 @@ tape( 'the function supports a negative `zy` stride', function test( t ) {
573554
0.52, // 1
574555
-1.51 // 1
575556
] );
576-
for ( k = 0; k < expected.length; k++ ) {
577-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
578-
}
557+
isApprox( t, viewY, expected, 14.0 );
579558
t.end();
580559
});
581560

@@ -585,7 +564,6 @@ tape( 'the function supports complex access patterns', function test( t ) {
585564
var za;
586565
var zx;
587566
var zy;
588-
var k;
589567

590568
zx = new Complex128Array( [
591569
0.7, // 4
@@ -640,8 +618,6 @@ tape( 'the function supports complex access patterns', function test( t ) {
640618
0.32, // 1
641619
-1.16 // 1
642620
] );
643-
for ( k = 0; k < expected.length; k++ ) {
644-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
645-
}
621+
isApprox( t, viewY, expected, 14.0 );
646622
t.end();
647623
});

lib/node_modules/@stdlib/blas/base/zaxpy/test/test.zaxpy.js

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ tape( 'the function scales elements from `zx` by `za` and adds the result to `zy
7777
var za;
7878
var zx;
7979
var zy;
80-
var k;
8180

8281
zx = new Complex128Array( [
8382
0.7, // 1
@@ -132,9 +131,7 @@ tape( 'the function scales elements from `zx` by `za` and adds the result to `zy
132131
0.8,
133132
-0.7
134133
] );
135-
for ( k = 0; k < expected.length; k++ ) {
136-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
137-
}
134+
isApprox( t, viewY, expected, 14.0 );
138135
t.end();
139136
});
140137

@@ -144,7 +141,6 @@ tape( 'the function supports a `zx` stride', function test( t ) {
144141
var za;
145142
var zx;
146143
var zy;
147-
var k;
148144

149145
zx = new Complex128Array( [
150146
0.7, // 1
@@ -199,9 +195,7 @@ tape( 'the function supports a `zx` stride', function test( t ) {
199195
0.8,
200196
-0.7
201197
] );
202-
for ( k = 0; k < expected.length; k++ ) {
203-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
204-
}
198+
isApprox( t, viewY, expected, 14.0 );
205199
t.end();
206200
});
207201

@@ -211,7 +205,6 @@ tape( 'the function supports a `zy` stride', function test( t ) {
211205
var za;
212206
var zx;
213207
var zy;
214-
var k;
215208

216209
zx = new Complex128Array( [
217210
0.7, // 1
@@ -266,9 +259,7 @@ tape( 'the function supports a `zy` stride', function test( t ) {
266259
0.32, // 4
267260
-1.16 // 4
268261
] );
269-
for ( k = 0; k < expected.length; k++ ) {
270-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
271-
}
262+
isApprox( t, viewY, expected, 14.0 );
272263
t.end();
273264
});
274265

@@ -317,7 +308,6 @@ tape( 'the function supports negative `zx` strides', function test( t ) {
317308
var za;
318309
var zx;
319310
var zy;
320-
var k;
321311

322312
zx = new Complex128Array( [
323313
0.7, // 4
@@ -372,9 +362,7 @@ tape( 'the function supports negative `zx` strides', function test( t ) {
372362
0.8,
373363
-0.7
374364
] );
375-
for ( k = 0; k < expected.length; k++ ) {
376-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
377-
}
365+
isApprox( t, viewY, expected, 14.0 );
378366
t.end();
379367
});
380368

@@ -384,7 +372,6 @@ tape( 'the function supports negative `zy` strides', function test( t ) {
384372
var za;
385373
var zx;
386374
var zy;
387-
var k;
388375

389376
zx = new Complex128Array( [
390377
0.7, // 1
@@ -439,9 +426,7 @@ tape( 'the function supports negative `zy` strides', function test( t ) {
439426
0.52, // 1
440427
-1.51 // 1
441428
] );
442-
for ( k = 0; k < expected.length; k++ ) {
443-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
444-
}
429+
isApprox( t, viewY, expected, 14.0 );
445430
t.end();
446431
});
447432

@@ -451,7 +436,6 @@ tape( 'the function supports complex access patterns', function test( t ) {
451436
var za;
452437
var zx;
453438
var zy;
454-
var k;
455439

456440
zx = new Complex128Array( [
457441
0.7, // 4
@@ -506,9 +490,7 @@ tape( 'the function supports complex access patterns', function test( t ) {
506490
0.32, // 1
507491
-1.16 // 1
508492
] );
509-
for ( k = 0; k < expected.length; k++ ) {
510-
isApprox( t, viewY[ k ], expected[ k ], 2.0 );
511-
}
493+
isApprox( t, viewY, expected, 14.0 );
512494
t.end();
513495
});
514496

@@ -543,7 +525,7 @@ tape( 'the function supports view offsets', function test( t ) {
543525
za = new Complex128( 2.0, 2.0 );
544526

545527
// Create offset views...
546-
zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element
528+
zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // begin at the 2nd element
547529
zy1 = new Complex128Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // begin at the 3rd element
548530

549531
zaxpy( 1, za, zx1, 1, zy1, 1 );

0 commit comments

Comments
 (0)