Skip to content

Commit 3cbc873

Browse files
committed
test: cover zero-beta branch
--- 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: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8827816 commit 3cbc873

3 files changed

Lines changed: 180 additions & 3 deletions

File tree

lib/node_modules/@stdlib/blas/base/cgbmv/lib/ndarray.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ var base = require( './base.js' );
5555
* @throws {TypeError} first argument must be a valid transpose operation
5656
* @throws {RangeError} second argument must be a nonnegative integer
5757
* @throws {RangeError} third argument must be a nonnegative integer
58-
* @throws {RangeError} eighth argument must be a nonnegative integer
59-
* @throws {RangeError} ninth argument must be a nonnegative integer
60-
* @throws {RangeError} tenth argument must be non-zero
58+
* @throws {RangeError} eighth argument must be non-zero
59+
* @throws {RangeError} ninth argument must be non-zero
6160
* @throws {RangeError} fourteenth argument must be non-zero
6261
* @returns {Complex64Array} `y`
6362
*

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,60 @@ tape( 'if `α` is `0`, the function scales the second input vector by `β` (colu
841841
t.end();
842842
});
843843

844+
tape( 'if `α` is `0` and `β` is `0`, the function zeros the second input vector (row-major)', function test( t ) {
845+
var expected;
846+
var alpha;
847+
var data;
848+
var beta;
849+
var out;
850+
var a;
851+
var x;
852+
var y;
853+
854+
data = ra;
855+
856+
a = new Complex64Array( data.A );
857+
x = new Complex64Array( data.x );
858+
y = new Complex64Array( data.y );
859+
860+
alpha = new Complex64( 0.0, 0.0 );
861+
beta = new Complex64( 0.0, 0.0 );
862+
863+
expected = new Complex64Array( data.y.length );
864+
865+
out = cgbmv( data.order, data.trans, data.M, data.N, data.KL, data.KU, alpha, a, data.lda, x, data.strideX, beta, y, data.strideY );
866+
t.deepEqual( out, expected, true, 'returns expected value' );
867+
868+
t.end();
869+
});
870+
871+
tape( 'if `α` is `0` and `β` is `0`, the function zeros the second input vector (column-major)', function test( t ) {
872+
var expected;
873+
var alpha;
874+
var data;
875+
var beta;
876+
var out;
877+
var a;
878+
var x;
879+
var y;
880+
881+
data = ca;
882+
883+
a = new Complex64Array( data.A );
884+
x = new Complex64Array( data.x );
885+
y = new Complex64Array( data.y );
886+
887+
alpha = new Complex64( 0.0, 0.0 );
888+
beta = new Complex64( 0.0, 0.0 );
889+
890+
expected = new Complex64Array( data.y.length );
891+
892+
out = cgbmv( data.order, data.trans, data.M, data.N, data.KL, data.KU, alpha, a, data.lda, x, data.strideX, beta, y, data.strideY );
893+
t.deepEqual( out, expected, true, 'returns expected value' );
894+
895+
t.end();
896+
});
897+
844898
tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (row-major)', function test( t ) {
845899
var expected;
846900
var alpha;

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

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,76 @@ tape( 'the function throws an error if provided an invalid fifth argument', func
262262
}
263263
});
264264

265+
tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) {
266+
var values;
267+
var alpha;
268+
var data;
269+
var beta;
270+
var i;
271+
var a;
272+
var x;
273+
var y;
274+
275+
data = rnt;
276+
277+
a = new Complex64Array( data.A );
278+
x = new Complex64Array( data.x );
279+
y = new Complex64Array( data.y );
280+
281+
alpha = new Complex64( data.alpha[0], data.alpha[1] );
282+
beta = new Complex64( data.beta[0], data.beta[1] );
283+
284+
values = [
285+
0
286+
];
287+
288+
for ( i = 0; i < values.length; i++ ) {
289+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
290+
}
291+
t.end();
292+
293+
function badValue( value ) {
294+
return function badValue() {
295+
cgbmv( data.trans, data.M, data.N, data.KL, data.KU, alpha, a, value, data.strideA2, data.offsetA, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY );
296+
};
297+
}
298+
});
299+
300+
tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) {
301+
var values;
302+
var alpha;
303+
var data;
304+
var beta;
305+
var i;
306+
var a;
307+
var x;
308+
var y;
309+
310+
data = rnt;
311+
312+
a = new Complex64Array( data.A );
313+
x = new Complex64Array( data.x );
314+
y = new Complex64Array( data.y );
315+
316+
alpha = new Complex64( data.alpha[0], data.alpha[1] );
317+
beta = new Complex64( data.beta[0], data.beta[1] );
318+
319+
values = [
320+
0
321+
];
322+
323+
for ( i = 0; i < values.length; i++ ) {
324+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
325+
}
326+
t.end();
327+
328+
function badValue( value ) {
329+
return function badValue() {
330+
cgbmv( data.trans, data.M, data.N, data.KL, data.KU, alpha, a, data.strideA1, value, data.offsetA, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY );
331+
};
332+
}
333+
});
334+
265335
tape( 'the function throws an error if provided an invalid twelfth argument', function test( t ) {
266336
var values;
267337
var alpha;
@@ -780,6 +850,60 @@ tape( 'if `α` is `0`, the function scales the second input vector by `β` (colu
780850
t.end();
781851
});
782852

853+
tape( 'if `α` is `0` and `β` is `0`, the function zeros the second input vector (row-major)', function test( t ) {
854+
var expected;
855+
var alpha;
856+
var data;
857+
var beta;
858+
var out;
859+
var a;
860+
var x;
861+
var y;
862+
863+
data = ra;
864+
865+
a = new Complex64Array( data.A );
866+
x = new Complex64Array( data.x );
867+
y = new Complex64Array( data.y );
868+
869+
alpha = new Complex64( 0.0, 0.0 );
870+
beta = new Complex64( 0.0, 0.0 );
871+
872+
expected = new Complex64Array( data.y.length );
873+
874+
out = cgbmv( data.trans, data.M, data.N, data.KL, data.KU, alpha, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY );
875+
t.deepEqual( out, expected, true, 'returns expected value' );
876+
877+
t.end();
878+
});
879+
880+
tape( 'if `α` is `0` and `β` is `0`, the function zeros the second input vector (column-major)', function test( t ) {
881+
var expected;
882+
var alpha;
883+
var data;
884+
var beta;
885+
var out;
886+
var a;
887+
var x;
888+
var y;
889+
890+
data = ca;
891+
892+
a = new Complex64Array( data.A );
893+
x = new Complex64Array( data.x );
894+
y = new Complex64Array( data.y );
895+
896+
alpha = new Complex64( 0.0, 0.0 );
897+
beta = new Complex64( 0.0, 0.0 );
898+
899+
expected = new Complex64Array( data.y.length );
900+
901+
out = cgbmv( data.trans, data.M, data.N, data.KL, data.KU, alpha, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY );
902+
t.deepEqual( out, expected, true, 'returns expected value' );
903+
904+
t.end();
905+
});
906+
783907
tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (row-major)', function test( t ) {
784908
var expected;
785909
var alpha;

0 commit comments

Comments
 (0)