From 7dcaa315131ab17f0db35e9916f637837edef38f Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 18 Apr 2025 17:19:28 +0530 Subject: [PATCH 1/2] test: add test cases for blas/base/dtrsv --- 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/dtrsv/lib/ndarray.js | 6 +++++ .../blas/base/dtrsv/test/test.ndarray.js | 27 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js index 2b1632d1bcc9..7199372ef4ba 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js @@ -72,6 +72,12 @@ function dtrsv( 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/dtrsv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js index d9bf45e70ad8..25db623479f1 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js @@ -180,7 +180,7 @@ tape( 'the function throws an error if provided an invalid fourth argument', fun } }); -tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { var values; var data; var i; @@ -198,7 +198,30 @@ tape( 'the function throws an error if provided an invalid tenth argument', func function badValue( value ) { return function badValue() { - dtrsv( data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), value, data.offsetX ); + dtrsv( data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), value, data.strideA2, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sventh 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() { + dtrsv( data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.strideA1, value, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); }; } }); From 5913d81503f4c48c57bb6189ead632dd52858e62 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 18 Apr 2025 17:59:12 +0530 Subject: [PATCH 2/2] chore: update test cases Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../blas/base/dtrsv/test/test.ndarray.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js index 25db623479f1..159d9422279c 100644 --- a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js @@ -203,7 +203,7 @@ tape( 'the function throws an error if provided an invalid sixth argument', func } }); -tape( 'the function throws an error if provided an invalid sventh argument', function test( t ) { +tape( 'the function throws an error if provided an invalid seventh argument', function test( t ) { var values; var data; var i; @@ -226,6 +226,29 @@ tape( 'the function throws an error if provided an invalid sventh argument', fun } }); +tape( 'the function throws an error if provided an invalid tenth 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() { + dtrsv( data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), value, data.offsetX ); + }; + } +}); + tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, no transpose, non-unit)', function test( t ) { var expected; var data;