Skip to content

test: add test cases for blas/base/dtrsv #6708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
Expand Down
46 changes: 46 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
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 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() {
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 );
};
}
});

tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) {
var values;
var data;
Expand Down