Skip to content

Commit 7dcaa31

Browse files
committed
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 ---
1 parent 9d6cd84 commit 7dcaa31

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ function dtrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
7272
if ( N < 0 ) {
7373
throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', N ) );
7474
}
75+
if ( strideA1 === 0 ) {
76+
throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideA1 ) );
77+
}
78+
if ( strideA2 === 0 ) {
79+
throw new RangeError( format( 'invalid argument. Seventh argument must be non-zero. Value: `%d`.', strideA2 ) );
80+
}
7581
if ( strideX === 0 ) {
7682
throw new RangeError( format( 'invalid argument. Tenth argument must be non-zero. Value: `%d`.', strideX ) );
7783
}

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ tape( 'the function throws an error if provided an invalid fourth argument', fun
180180
}
181181
});
182182

183-
tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) {
183+
tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) {
184184
var values;
185185
var data;
186186
var i;
@@ -198,7 +198,30 @@ tape( 'the function throws an error if provided an invalid tenth argument', func
198198

199199
function badValue( value ) {
200200
return function badValue() {
201-
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 );
201+
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 );
202+
};
203+
}
204+
});
205+
206+
tape( 'the function throws an error if provided an invalid sventh argument', function test( t ) {
207+
var values;
208+
var data;
209+
var i;
210+
211+
data = rutu;
212+
213+
values = [
214+
0
215+
];
216+
217+
for ( i = 0; i < values.length; i++ ) {
218+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
219+
}
220+
t.end();
221+
222+
function badValue( value ) {
223+
return function badValue() {
224+
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 );
202225
};
203226
}
204227
});

0 commit comments

Comments
 (0)