Skip to content

Commit 9429930

Browse files
committed
test: more tests
--- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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 a5c4abd commit 9429930

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
22+
var Float64Array = require( '@stdlib/array/float64' );
23+
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
24+
var iladlr = require( './../lib' );
25+
26+
var shape = [ 3, 3 ];
27+
var order = 'row-major';
28+
var strides = shape2strides( shape, order );
29+
30+
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 0.0 ] );
31+
console.log( ndarray2array( A, shape, strides, 0, order ) );
32+
33+
var out = iladlr( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ] );
34+
console.log( out );

lib/node_modules/@stdlib/lapack/base/iladlr/test/test.iladlr.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,34 @@ tape( 'the function throws an error if provided a fourth argument which is not a
111111
}
112112
});
113113

114+
tape( 'the function returns an invalid index (-1) when M is zero', function test( t ) {
115+
var data;
116+
var out;
117+
var A;
118+
119+
data = ROW_MAJOR_DATA;
120+
121+
A = new Float64Array( data.A );
122+
out = iladlr( data.order, 0, data.N, A, data.LDA );
123+
124+
t.deepEqual( out, -1, 'returns expected value' );
125+
t.end();
126+
});
127+
128+
tape( 'the function returns an invalid index (-1) when N is zero', function test( t ) {
129+
var data;
130+
var out;
131+
var A;
132+
133+
data = ROW_MAJOR_DATA;
134+
135+
A = new Float64Array( data.A );
136+
out = iladlr( data.order, data.M, 0, A, data.LDA );
137+
138+
t.deepEqual( out, -1, 'returns expected value' );
139+
t.end();
140+
});
141+
114142
tape( 'the function returns the expected zero based index of the last non zero row of a matrix (row-major)', function test( t ) {
115143
var data;
116144
var out;

0 commit comments

Comments
 (0)