From df3cbeba3362c574f03cc624587f529a126a8d6d Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 19 Apr 2025 17:53:55 +0530 Subject: [PATCH 1/2] test: add test cases for blas/base/strmv --- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/strmv/lib/ndarray.js | 6 +++ .../blas/base/strmv/test/test.ndarray.js | 46 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js index b3d926607656..aac5df5cb767 100644 --- a/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js @@ -72,6 +72,12 @@ function strmv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX if ( N < 0 ) { throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', N ) ); } + if ( strideA1 === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideA1 ) ); + } + if ( strideA2 === 0 ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be non-zero. Value: `%d`.', strideA2 ) ); + } if ( strideX === 0 ) { throw new RangeError( format( 'invalid argument. Tenth argument must be non-zero. Value: `%d`.', strideX ) ); } diff --git a/lib/node_modules/@stdlib/blas/base/strmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/strmv/test/test.ndarray.js index d1df4fe1952e..208fe74fd3f1 100644 --- a/lib/node_modules/@stdlib/blas/base/strmv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/strmv/test/test.ndarray.js @@ -180,6 +180,52 @@ tape( 'the function throws an error if provided an invalid fourth argument', fun } }); +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + strmv( data.uplo, data.trans, data.diag, data.N, new Float32Array( data.A ), value, data.strideA2, data.offsetA, new Float32Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventh argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + strmv( data.uplo, data.trans, data.diag, data.N, new Float32Array( data.A ), data.strideA1, value, data.offsetA, new Float32Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { var values; var data; From 0eb956c4f871d29fbf665bb0702e41e56eaf6221 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 20 Apr 2025 11:58:37 +0530 Subject: [PATCH 2/2] chore: add jsdoc --- 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: na - 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 --- --- lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js index aac5df5cb767..8feb20cb6ee3 100644 --- a/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/strmv/lib/ndarray.js @@ -47,6 +47,8 @@ var base = require( './base.js' ); * @throws {TypeError} second argument must be a valid transpose operation * @throws {TypeError} third argument must be a valid diagonal type * @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be non-zero +* @throws {RangeError} seventh argument must be non-zero * @throws {RangeError} tenth argument must be non-zero * @returns {Float32Array} `x` *