Skip to content

Commit 87b6637

Browse files
committed
chore: add test cases
--- 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 edc384c commit 87b6637

File tree

6 files changed

+183
-3
lines changed

6 files changed

+183
-3
lines changed

lib/node_modules/@stdlib/blas/base/dger/test/fixtures/column_major.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"x": [ 1.0, 1.0 ],
77
"strideX": 1,
88
"offsetX": 0,
9-
"y": [ 0.0, 0.0, 0.0 ],
9+
"y": [ 1.0, 1.0, 1.0 ],
1010
"strideY": 1,
1111
"offsetY": 0,
1212
"A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ],
@@ -18,5 +18,5 @@
1818
"strideA1": 1,
1919
"strideA2": 2,
2020
"offsetA": 0,
21-
"A_out": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ]
21+
"A_out": [ 2.0, 5.0, 3.0, 6.0, 4.0, 7.0 ]
2222
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"order": "column-major",
3+
"M": 2,
4+
"N": 3,
5+
"alpha": 1.0,
6+
"x": [ 0.0, 0.0 ],
7+
"strideX": 1,
8+
"offsetX": 0,
9+
"y": [ 1.0, 1.0, 1.0 ],
10+
"strideY": 1,
11+
"offsetY": 0,
12+
"A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ],
13+
"A_mat": [
14+
[ 1.0, 2.0, 3.0 ],
15+
[ 4.0, 5.0, 6.0 ]
16+
],
17+
"lda": 2,
18+
"strideA1": 1,
19+
"strideA2": 2,
20+
"offsetA": 0,
21+
"A_out": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ]
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"order": "column-major",
3+
"M": 2,
4+
"N": 3,
5+
"alpha": 1.0,
6+
"x": [ 1.0, 1.0 ],
7+
"strideX": 1,
8+
"offsetX": 0,
9+
"y": [ 0.0, 0.0, 0.0 ],
10+
"strideY": 1,
11+
"offsetY": 0,
12+
"A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ],
13+
"A_mat": [
14+
[ 1.0, 2.0, 3.0 ],
15+
[ 4.0, 5.0, 6.0 ]
16+
],
17+
"lda": 2,
18+
"strideA1": 1,
19+
"strideA2": 2,
20+
"offsetA": 0,
21+
"A_out": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ]
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"order": "row-major",
3+
"M": 2,
4+
"N": 3,
5+
"alpha": 1.0,
6+
"x": [ 0.0, 0.0 ],
7+
"strideX": 1,
8+
"offsetX": 0,
9+
"y": [ 1.0, 1.0, 1.0 ],
10+
"strideY": 1,
11+
"offsetY": 0,
12+
"A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ],
13+
"A_mat": [
14+
[ 1.0, 2.0, 3.0 ],
15+
[ 4.0, 5.0, 6.0 ]
16+
],
17+
"lda": 3,
18+
"strideA1": 3,
19+
"strideA2": 1,
20+
"offsetA": 0,
21+
"A_out": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"order": "row-major",
3+
"M": 2,
4+
"N": 3,
5+
"alpha": 1.0,
6+
"x": [ 1.0, 1.0 ],
7+
"strideX": 1,
8+
"offsetX": 0,
9+
"y": [ 0.0, 0.0, 0.0 ],
10+
"strideY": 1,
11+
"offsetY": 0,
12+
"A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ],
13+
"A_mat": [
14+
[ 1.0, 2.0, 3.0 ],
15+
[ 4.0, 5.0, 6.0 ]
16+
],
17+
"lda": 3,
18+
"strideA1": 3,
19+
"strideA2": 1,
20+
"offsetA": 0,
21+
"A_out": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]
22+
}

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

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ var cxpyp = require( './fixtures/column_major_xpyp.json' );
3434
var cxnyp = require( './fixtures/column_major_xnyp.json' );
3535
var cxpyn = require( './fixtures/column_major_xpyn.json' );
3636
var cxnyn = require( './fixtures/column_major_xnyn.json' );
37+
var cx0 = require( './fixtures/column_major_x_zeros.json' );
38+
var cy0 = require( './fixtures/column_major_y_zeros.json' );
3739

3840
var rm = require( './fixtures/row_major.json' );
3941
var rxpyp = require( './fixtures/row_major_xpyp.json' );
4042
var rxnyp = require( './fixtures/row_major_xnyp.json' );
4143
var rxpyn = require( './fixtures/row_major_xpyn.json' );
4244
var rxnyn = require( './fixtures/row_major_xnyn.json' );
45+
var rx0 = require( './fixtures/row_major_x_zeros.json' );
46+
var ry0 = require( './fixtures/row_major_y_zeros.json' );
4347

4448

4549
// TESTS //
@@ -472,7 +476,95 @@ tape( 'the function supports specifying a negative `x` stride (column-major)', f
472476
t.end();
473477
});
474478

475-
tape( 'the function supports specifying a negative `y` stride (row-major)', function test( t ) {
479+
tape( 'the function returns the input matrix unchanged if input `x` filled with zeroes (row-major)', function test( t ) {
480+
var expected;
481+
var data;
482+
var out;
483+
var a;
484+
var x;
485+
var y;
486+
487+
data = rx0;
488+
489+
a = new Float64Array( data.A );
490+
x = new Float64Array( data.x );
491+
y = new Float64Array( data.y );
492+
493+
expected = new Float64Array( data.A_out );
494+
495+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
496+
t.strictEqual( out, a, 'returns expected value' );
497+
t.deepEqual( out, expected, 'returns expected value' );
498+
t.end();
499+
});
500+
501+
tape( 'the function returns the input matrix unchanged if input `x` filled with zeroes (column-major)', function test( t ) {
502+
var expected;
503+
var data;
504+
var out;
505+
var a;
506+
var x;
507+
var y;
508+
509+
data = cx0;
510+
511+
a = new Float64Array( data.A );
512+
x = new Float64Array( data.x );
513+
y = new Float64Array( data.y );
514+
515+
expected = new Float64Array( data.A_out );
516+
517+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
518+
t.strictEqual( out, a, 'returns expected value' );
519+
t.deepEqual( out, expected, 'returns expected value' );
520+
t.end();
521+
});
522+
523+
tape( 'the function returns the input matrix unchanged if input `y` filled with zeroes (row-major)', function test( t ) {
524+
var expected;
525+
var data;
526+
var out;
527+
var a;
528+
var x;
529+
var y;
530+
531+
data = ry0;
532+
533+
a = new Float64Array( data.A );
534+
x = new Float64Array( data.x );
535+
y = new Float64Array( data.y );
536+
537+
expected = new Float64Array( data.A_out );
538+
539+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
540+
t.strictEqual( out, a, 'returns expected value' );
541+
t.deepEqual( out, expected, 'returns expected value' );
542+
t.end();
543+
});
544+
545+
tape( 'the function returns the input matrix unchanged if input `y` filled with zeroes (column-major)', function test( t ) {
546+
var expected;
547+
var data;
548+
var out;
549+
var a;
550+
var x;
551+
var y;
552+
553+
data = cy0;
554+
555+
a = new Float64Array( data.A );
556+
x = new Float64Array( data.x );
557+
y = new Float64Array( data.y );
558+
559+
expected = new Float64Array( data.A_out );
560+
561+
out = dger( data.order, data.M, data.N, data.alpha, x, data.strideX, y, data.strideY, a, data.lda );
562+
t.strictEqual( out, a, 'returns expected value' );
563+
t.deepEqual( out, expected, 'returns expected value' );
564+
t.end();
565+
});
566+
567+
tape( 'the function returns (row-major)', function test( t ) {
476568
var expected;
477569
var data;
478570
var out;

0 commit comments

Comments
 (0)