Skip to content

Commit 525f4f6

Browse files
committed
test: fix test description and add tests
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 87b6637 commit 525f4f6

File tree

4 files changed

+293
-17
lines changed

4 files changed

+293
-17
lines changed

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,15 @@ tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (column
388388
t.end();
389389
});
390390

391-
tape( 'the function supports specifying `x` and `y` strides (row-major)', function test( t ) {
391+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) {
392392
var expected;
393393
var data;
394394
var out;
395395
var a;
396396
var x;
397397
var y;
398398

399-
data = rxpyp;
399+
data = rx0;
400400

401401
a = new Float64Array( data.A );
402402
x = new Float64Array( data.x );
@@ -410,15 +410,15 @@ tape( 'the function supports specifying `x` and `y` strides (row-major)', functi
410410
t.end();
411411
});
412412

413-
tape( 'the function supports specifying `x` and `y` strides (column-major)', function test( t ) {
413+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) {
414414
var expected;
415415
var data;
416416
var out;
417417
var a;
418418
var x;
419419
var y;
420420

421-
data = cxpyp;
421+
data = cx0;
422422

423423
a = new Float64Array( data.A );
424424
x = new Float64Array( data.x );
@@ -432,15 +432,15 @@ tape( 'the function supports specifying `x` and `y` strides (column-major)', fun
432432
t.end();
433433
});
434434

435-
tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) {
435+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) {
436436
var expected;
437437
var data;
438438
var out;
439439
var a;
440440
var x;
441441
var y;
442442

443-
data = rxnyp;
443+
data = ry0;
444444

445445
a = new Float64Array( data.A );
446446
x = new Float64Array( data.x );
@@ -454,15 +454,15 @@ tape( 'the function supports specifying a negative `x` stride (row-major)', func
454454
t.end();
455455
});
456456

457-
tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) {
457+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) {
458458
var expected;
459459
var data;
460460
var out;
461461
var a;
462462
var x;
463463
var y;
464464

465-
data = cxnyp;
465+
data = cy0;
466466

467467
a = new Float64Array( data.A );
468468
x = new Float64Array( data.x );
@@ -476,15 +476,15 @@ tape( 'the function supports specifying a negative `x` stride (column-major)', f
476476
t.end();
477477
});
478478

479-
tape( 'the function returns the input matrix unchanged if input `x` filled with zeroes (row-major)', function test( t ) {
479+
tape( 'the function supports specifying `x` and `y` strides (row-major)', function test( t ) {
480480
var expected;
481481
var data;
482482
var out;
483483
var a;
484484
var x;
485485
var y;
486486

487-
data = rx0;
487+
data = rxpyp;
488488

489489
a = new Float64Array( data.A );
490490
x = new Float64Array( data.x );
@@ -498,15 +498,15 @@ tape( 'the function returns the input matrix unchanged if input `x` filled with
498498
t.end();
499499
});
500500

501-
tape( 'the function returns the input matrix unchanged if input `x` filled with zeroes (column-major)', function test( t ) {
501+
tape( 'the function supports specifying `x` and `y` strides (column-major)', function test( t ) {
502502
var expected;
503503
var data;
504504
var out;
505505
var a;
506506
var x;
507507
var y;
508508

509-
data = cx0;
509+
data = cxpyp;
510510

511511
a = new Float64Array( data.A );
512512
x = new Float64Array( data.x );
@@ -520,15 +520,15 @@ tape( 'the function returns the input matrix unchanged if input `x` filled with
520520
t.end();
521521
});
522522

523-
tape( 'the function returns the input matrix unchanged if input `y` filled with zeroes (row-major)', function test( t ) {
523+
tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) {
524524
var expected;
525525
var data;
526526
var out;
527527
var a;
528528
var x;
529529
var y;
530530

531-
data = ry0;
531+
data = rxnyp;
532532

533533
a = new Float64Array( data.A );
534534
x = new Float64Array( data.x );
@@ -542,15 +542,15 @@ tape( 'the function returns the input matrix unchanged if input `y` filled with
542542
t.end();
543543
});
544544

545-
tape( 'the function returns the input matrix unchanged if input `y` filled with zeroes (column-major)', function test( t ) {
545+
tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) {
546546
var expected;
547547
var data;
548548
var out;
549549
var a;
550550
var x;
551551
var y;
552552

553-
data = cy0;
553+
data = cxnyp;
554554

555555
a = new Float64Array( data.A );
556556
x = new Float64Array( data.x );
@@ -564,7 +564,7 @@ tape( 'the function returns the input matrix unchanged if input `y` filled with
564564
t.end();
565565
});
566566

567-
tape( 'the function returns (row-major)', function test( t ) {
567+
tape( 'the function supports specifying a negative `y` stride (row-major)', function test( t ) {
568568
var expected;
569569
var data;
570570
var out;

lib/node_modules/@stdlib/blas/base/dger/test/test.dger.native.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ var cxpyp = require( './fixtures/column_major_xpyp.json' );
4343
var cxnyp = require( './fixtures/column_major_xnyp.json' );
4444
var cxpyn = require( './fixtures/column_major_xpyn.json' );
4545
var cxnyn = require( './fixtures/column_major_xnyn.json' );
46+
var cx0 = require( './fixtures/column_major_x_zeros.json' );
47+
var cy0 = require( './fixtures/column_major_y_zeros.json' );
4648

4749
var rm = require( './fixtures/row_major.json' );
4850
var rxpyp = require( './fixtures/row_major_xpyp.json' );
4951
var rxnyp = require( './fixtures/row_major_xnyp.json' );
5052
var rxpyn = require( './fixtures/row_major_xpyn.json' );
5153
var rxnyn = require( './fixtures/row_major_xnyn.json' );
54+
var rx0 = require( './fixtures/row_major_x_zeros.json' );
55+
var ry0 = require( './fixtures/row_major_y_zeros.json' );
5256

5357

5458
// TESTS //
@@ -393,6 +397,94 @@ tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (column
393397
t.end();
394398
});
395399

400+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (row-major)', opts, function test( t ) {
401+
var expected;
402+
var data;
403+
var out;
404+
var a;
405+
var x;
406+
var y;
407+
408+
data = rx0;
409+
410+
a = new Float64Array( data.A );
411+
x = new Float64Array( data.x );
412+
y = new Float64Array( data.y );
413+
414+
expected = new Float64Array( data.A_out );
415+
416+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
417+
t.strictEqual( out, a, 'returns expected value' );
418+
t.deepEqual( out, expected, 'returns expected value' );
419+
t.end();
420+
});
421+
422+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (column-major)', opts, function test( t ) {
423+
var expected;
424+
var data;
425+
var out;
426+
var a;
427+
var x;
428+
var y;
429+
430+
data = cx0;
431+
432+
a = new Float64Array( data.A );
433+
x = new Float64Array( data.x );
434+
y = new Float64Array( data.y );
435+
436+
expected = new Float64Array( data.A_out );
437+
438+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
439+
t.strictEqual( out, a, 'returns expected value' );
440+
t.deepEqual( out, expected, 'returns expected value' );
441+
t.end();
442+
});
443+
444+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (row-major)', opts, function test( t ) {
445+
var expected;
446+
var data;
447+
var out;
448+
var a;
449+
var x;
450+
var y;
451+
452+
data = ry0;
453+
454+
a = new Float64Array( data.A );
455+
x = new Float64Array( data.x );
456+
y = new Float64Array( data.y );
457+
458+
expected = new Float64Array( data.A_out );
459+
460+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
461+
t.strictEqual( out, a, 'returns expected value' );
462+
t.deepEqual( out, expected, 'returns expected value' );
463+
t.end();
464+
});
465+
466+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (column-major)', opts, function test( t ) {
467+
var expected;
468+
var data;
469+
var out;
470+
var a;
471+
var x;
472+
var y;
473+
474+
data = cy0;
475+
476+
a = new Float64Array( data.A );
477+
x = new Float64Array( data.x );
478+
y = new Float64Array( data.y );
479+
480+
expected = new Float64Array( data.A_out );
481+
482+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
483+
t.strictEqual( out, a, 'returns expected value' );
484+
t.deepEqual( out, expected, 'returns expected value' );
485+
t.end();
486+
});
487+
396488
tape( 'the function supports specifying `x` and `y` strides (row-major)', opts, function test( t ) {
397489
var expected;
398490
var data;

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ var csa1nsa2 = require( './fixtures/column_major_sa1n_sa2.json' );
4242
var csa1sa2n = require( './fixtures/column_major_sa1_sa2n.json' );
4343
var csa1nsa2n = require( './fixtures/column_major_sa1n_sa2n.json' );
4444
var ccap = require( './fixtures/column_major_complex_access_pattern.json' );
45+
var cx0 = require( './fixtures/column_major_x_zeros.json' );
46+
var cy0 = require( './fixtures/column_major_y_zeros.json' );
4547

4648
var rm = require( './fixtures/row_major.json' );
4749
var roa = require( './fixtures/row_major_oa.json' );
@@ -56,6 +58,8 @@ var rsa1nsa2 = require( './fixtures/row_major_sa1n_sa2.json' );
5658
var rsa1sa2n = require( './fixtures/row_major_sa1_sa2n.json' );
5759
var rsa1nsa2n = require( './fixtures/row_major_sa1n_sa2n.json' );
5860
var rcap = require( './fixtures/row_major_complex_access_pattern.json' );
61+
var rx0 = require( './fixtures/row_major_x_zeros.json' );
62+
var ry0 = require( './fixtures/row_major_y_zeros.json' );
5963

6064

6165
// TESTS //
@@ -347,6 +351,94 @@ tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (column
347351
t.end();
348352
});
349353

354+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) {
355+
var expected;
356+
var data;
357+
var out;
358+
var a;
359+
var x;
360+
var y;
361+
362+
data = rx0;
363+
364+
a = new Float64Array( data.A );
365+
x = new Float64Array( data.x );
366+
y = new Float64Array( data.y );
367+
368+
expected = new Float64Array( data.A_out );
369+
370+
out = dger( data.M, data.N, data.alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA );
371+
t.strictEqual( out, a, 'returns expected value' );
372+
t.deepEqual( out, expected, 'returns expected value' );
373+
t.end();
374+
});
375+
376+
tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) {
377+
var expected;
378+
var data;
379+
var out;
380+
var a;
381+
var x;
382+
var y;
383+
384+
data = cx0;
385+
386+
a = new Float64Array( data.A );
387+
x = new Float64Array( data.x );
388+
y = new Float64Array( data.y );
389+
390+
expected = new Float64Array( data.A_out );
391+
392+
out = dger( data.M, data.N, data.alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA );
393+
t.strictEqual( out, a, 'returns expected value' );
394+
t.deepEqual( out, expected, 'returns expected value' );
395+
t.end();
396+
});
397+
398+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) {
399+
var expected;
400+
var data;
401+
var out;
402+
var a;
403+
var x;
404+
var y;
405+
406+
data = ry0;
407+
408+
a = new Float64Array( data.A );
409+
x = new Float64Array( data.x );
410+
y = new Float64Array( data.y );
411+
412+
expected = new Float64Array( data.A_out );
413+
414+
out = dger( data.M, data.N, data.alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA );
415+
t.strictEqual( out, a, 'returns expected value' );
416+
t.deepEqual( out, expected, 'returns expected value' );
417+
t.end();
418+
});
419+
420+
tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) {
421+
var expected;
422+
var data;
423+
var out;
424+
var a;
425+
var x;
426+
var y;
427+
428+
data = cy0;
429+
430+
a = new Float64Array( data.A );
431+
x = new Float64Array( data.x );
432+
y = new Float64Array( data.y );
433+
434+
expected = new Float64Array( data.A_out );
435+
436+
out = dger( data.M, data.N, data.alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA );
437+
t.strictEqual( out, a, 'returns expected value' );
438+
t.deepEqual( out, expected, 'returns expected value' );
439+
t.end();
440+
});
441+
350442
tape( 'the function supports specifying the strides of the first and second dimensions of `A` (row-major)', function test( t ) {
351443
var expected;
352444
var data;

0 commit comments

Comments
 (0)