Skip to content

Commit 11547d9

Browse files
authored
test: add test cases for blas/base/ssyr
PR-URL: #6727 Reviewed-by: Athan Reines <[email protected]>
1 parent b6e0aca commit 11547d9

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ function ssyr( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offse
6464
if ( strideX === 0 ) {
6565
throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) );
6666
}
67+
if ( strideA1 === 0 ) {
68+
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideA1 ) );
69+
}
70+
if ( strideA2 === 0 ) {
71+
throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideA2 ) );
72+
}
6773
if ( N === 0 || alpha === 0.0 ) {
6874
return A;
6975
}

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

+46
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,52 @@ tape( 'the function throws an error if provided an invalid fifth argument', func
139139
}
140140
});
141141

142+
tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) {
143+
var values;
144+
var data;
145+
var i;
146+
147+
data = ru;
148+
149+
values = [
150+
0
151+
];
152+
153+
for ( i = 0; i < values.length; i++ ) {
154+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
155+
}
156+
t.end();
157+
158+
function badValue( value ) {
159+
return function badValue() {
160+
ssyr( data.uplo, data.N, data.alpha, new Float32Array( data.x ), data.strideX, data.offsetX, new Float32Array( data.A ), value, data.strideA2, data.offsetA );
161+
};
162+
}
163+
});
164+
165+
tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) {
166+
var values;
167+
var data;
168+
var i;
169+
170+
data = ru;
171+
172+
values = [
173+
0
174+
];
175+
176+
for ( i = 0; i < values.length; i++ ) {
177+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
178+
}
179+
t.end();
180+
181+
function badValue( value ) {
182+
return function badValue() {
183+
ssyr( data.uplo, data.N, data.alpha, new Float32Array( data.x ), data.strideX, data.offsetX, new Float32Array( data.A ), data.strideA1, value, data.offsetA );
184+
};
185+
}
186+
});
187+
142188
tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (row-major, upper)', function test( t ) {
143189
var expected;
144190
var data;

0 commit comments

Comments
 (0)