Skip to content

Commit 7482626

Browse files
committed
test: add test cases for blas/base/dsyr2
--- 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 b6e0aca commit 7482626

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ function dsyr2( uplo, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, str
7272
if ( strideY === 0 ) {
7373
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) );
7474
}
75+
if ( strideA1 === 0 ) {
76+
throw new RangeError( format( 'invalid argument. Eleventh argument must be non-zero. Value: `%d`.', strideA1 ) );
77+
}
78+
if ( strideA2 === 0 ) {
79+
throw new RangeError( format( 'invalid argument. Twelfth argument must be non-zero. Value: `%d`.', strideA2 ) );
80+
}
7581
if ( N === 0 || alpha === 0.0 ) {
7682
return A;
7783
}

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,52 @@ tape( 'the function throws an error if provided an invalid eighth argument', fun
168168
}
169169
});
170170

171+
tape( 'the function throws an error if provided an invalid eleventh argument', function test( t ) {
172+
var values;
173+
var data;
174+
var i;
175+
176+
data = ru;
177+
178+
values = [
179+
0
180+
];
181+
182+
for ( i = 0; i < values.length; i++ ) {
183+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
184+
}
185+
t.end();
186+
187+
function badValue( value ) {
188+
return function badValue() {
189+
dsyr2( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.y ), data.strideY, data.offsetY, new Float64Array( data.A ), value, data.strideA2, data.offsetA );
190+
};
191+
}
192+
});
193+
194+
tape( 'the function throws an error if provided an invalid twelfth argument', function test( t ) {
195+
var values;
196+
var data;
197+
var i;
198+
199+
data = ru;
200+
201+
values = [
202+
0
203+
];
204+
205+
for ( i = 0; i < values.length; i++ ) {
206+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
207+
}
208+
t.end();
209+
210+
function badValue( value ) {
211+
return function badValue() {
212+
dsyr2( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.y ), data.strideY, data.offsetY, new Float64Array( data.A ), data.strideA1, value, data.offsetA );
213+
};
214+
}
215+
});
216+
171217
tape( 'the function performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` (row-major, upper)', function test( t ) {
172218
var expected;
173219
var data;

0 commit comments

Comments
 (0)