Skip to content

Commit b21fcc4

Browse files
committed
docs: add test.ts
--- 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: na - task: lint_javascript_tests status: na - 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: passed - task: lint_license_headers status: passed ---
1 parent da8c580 commit b21fcc4

File tree

1 file changed

+213
-0
lines changed
  • lib/node_modules/@stdlib/lapack/base/iladlr/docs/types

1 file changed

+213
-0
lines changed
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
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+
import iladlr = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
const A = new Float64Array( 4 );
27+
28+
iladlr( 'row-major', 2, 2, A, 2 ); // $ExpectType number
29+
}
30+
31+
// The compiler throws an error if the function is provided a first argument which is not a string...
32+
{
33+
const A = new Float64Array( 4 );
34+
35+
iladlr( 5, 2, 2, A, 2 ); // $ExpectError
36+
iladlr( true, 2, 2, A, 2 ); // $ExpectError
37+
iladlr( false, 2, 2, A, 2 ); // $ExpectError
38+
iladlr( null, 2, 2, A, 2 ); // $ExpectError
39+
iladlr( void 0, 2, 2, A, 2 ); // $ExpectError
40+
iladlr( [], 2, 2, A, 2 ); // $ExpectError
41+
iladlr( {}, 2, 2, A, 2 ); // $ExpectError
42+
iladlr( ( x: number ): number => x, 2, 2, A, 2 ); // $ExpectError
43+
}
44+
45+
// The compiler throws an error if the function is provided a second argument which is not a number...
46+
{
47+
const A = new Float64Array( 4 );
48+
49+
iladlr( 'row-major', '5', 2, A, 2 ); // $ExpectError
50+
iladlr( 'row-major', true, 2, A, 2 ); // $ExpectError
51+
iladlr( 'row-major', false, 2, A, 2 ); // $ExpectError
52+
iladlr( 'row-major', null, 2, A, 2 ); // $ExpectError
53+
iladlr( 'row-major', void 0, 2, A, 2 ); // $ExpectError
54+
iladlr( 'row-major', [], 2, A, 2 ); // $ExpectError
55+
iladlr( 'row-major', {}, 2, A, 2 ); // $ExpectError
56+
iladlr( 'row-major', ( x: number ): number => x, 2, A, 2 ); // $ExpectError
57+
}
58+
59+
// The compiler throws an error if the function is provided a third argument which is not a number...
60+
{
61+
const A = new Float64Array( 4 );
62+
63+
iladlr( 'row-major', 2, '5', A, 2 ); // $ExpectError
64+
iladlr( 'row-major', 2, true, A, 2 ); // $ExpectError
65+
iladlr( 'row-major', 2, false, A, 2 ); // $ExpectError
66+
iladlr( 'row-major', 2, null, A, 2 ); // $ExpectError
67+
iladlr( 'row-major', 2, void 0, A, 2 ); // $ExpectError
68+
iladlr( 'row-major', 2, [], A, 2 ); // $ExpectError
69+
iladlr( 'row-major', 2, {}, A, 2 ); // $ExpectError
70+
iladlr( 'row-major', 2, ( x: number ): number => x, A, 2 ); // $ExpectError
71+
}
72+
73+
// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array...
74+
{
75+
iladlr( 'row-major', 2, 2, '5', 2 ); // $ExpectError
76+
iladlr( 'row-major', 2, 2, 5, 2 ); // $ExpectError
77+
iladlr( 'row-major', 2, 2, true, 2 ); // $ExpectError
78+
iladlr( 'row-major', 2, 2, false, 2 ); // $ExpectError
79+
iladlr( 'row-major', 2, 2, null, 2 ); // $ExpectError
80+
iladlr( 'row-major', 2, 2, void 0, 2 ); // $ExpectError
81+
iladlr( 'row-major', 2, 2, [], 2 ); // $ExpectError
82+
iladlr( 'row-major', 2, 2, {}, 2 ); // $ExpectError
83+
iladlr( 'row-major', 2, 2, ( x: number ): number => x, 2 ); // $ExpectError
84+
}
85+
86+
// The compiler throws an error if the function is provided a fifth argument which is not a number...
87+
{
88+
const A = new Float64Array( 4 );
89+
90+
iladlr( 'row-major', 2, 2, A, '5' ); // $ExpectError
91+
iladlr( 'row-major', 2, 2, A, true ); // $ExpectError
92+
iladlr( 'row-major', 2, 2, A, false ); // $ExpectError
93+
iladlr( 'row-major', 2, 2, A, null ); // $ExpectError
94+
iladlr( 'row-major', 2, 2, A, void 0 ); // $ExpectError
95+
iladlr( 'row-major', 2, 2, A, [] ); // $ExpectError
96+
iladlr( 'row-major', 2, 2, A, {} ); // $ExpectError
97+
iladlr( 'row-major', 2, 2, A, ( x: number ): number => x ); // $ExpectError
98+
}
99+
100+
// The compiler throws an error if the function is provided an unsupported number of arguments...
101+
{
102+
const A = new Float64Array( 4 );
103+
104+
iladlr(); // $ExpectError
105+
iladlr( 'row-major' ); // $ExpectError
106+
iladlr( 'row-major', 2 ); // $ExpectError
107+
iladlr( 'row-major', 2, 2 ); // $ExpectError
108+
iladlr( 'row-major', 2, 2, A ); // $ExpectError
109+
iladlr( 'row-major', 2, 2, A, 2, 10 ); // $ExpectError
110+
}
111+
112+
// Attached to main export is an `ndarray` method which returns a number...
113+
{
114+
const A = new Float64Array( 4 );
115+
116+
iladlr.ndarray( 2, 2, A, 2, 1, 0 ); // $ExpectType number
117+
}
118+
119+
// The compiler throws an error if the function is provided a first argument which is not a number...
120+
{
121+
const A = new Float64Array( 4 );
122+
123+
iladlr.ndarray( '5', 2, A, 2, 1, 0 ); // $ExpectError
124+
iladlr.ndarray( true, 2, A, 2, 1, 0 ); // $ExpectError
125+
iladlr.ndarray( false, 2, A, 2, 1, 0 ); // $ExpectError
126+
iladlr.ndarray( null, 2, A, 2, 1, 0 ); // $ExpectError
127+
iladlr.ndarray( void 0, 2, A, 2, 1, 0 ); // $ExpectError
128+
iladlr.ndarray( [], 2, A, 2, 1, 0 ); // $ExpectError
129+
iladlr.ndarray( {}, 2, A, 2, 1, 0 ); // $ExpectError
130+
iladlr.ndarray( ( x: number ): number => x, 2, A, 2, 1, 0 ); // $ExpectError
131+
}
132+
133+
// The compiler throws an error if the function is provided a second argument which is not a number...
134+
{
135+
const A = new Float64Array( 4 );
136+
137+
iladlr.ndarray( 2, '5', A, 2, 1, 0 ); // $ExpectError
138+
iladlr.ndarray( 2, true, A, 2, 1, 0 ); // $ExpectError
139+
iladlr.ndarray( 2, false, A, 2, 1, 0 ); // $ExpectError
140+
iladlr.ndarray( 2, null, A, 2, 1, 0 ); // $ExpectError
141+
iladlr.ndarray( 2, void 0, A, 2, 1, 0 ); // $ExpectError
142+
iladlr.ndarray( 2, [], A, 2, 1, 0 ); // $ExpectError
143+
iladlr.ndarray( 2, {}, A, 2, 1, 0 ); // $ExpectError
144+
iladlr.ndarray( 2, ( x: number ): number => x, A, 2, 1, 0 ); // $ExpectError
145+
}
146+
147+
// The compiler throws an error if the function is provided a third argument which is not a Float64Array...
148+
{
149+
iladlr.ndarray( 2, 2, '5', 2, 1, 0 ); // $ExpectError
150+
iladlr.ndarray( 2, 2, 5, 2, 1, 0 ); // $ExpectError
151+
iladlr.ndarray( 2, 2, true, 2, 1, 0 ); // $ExpectError
152+
iladlr.ndarray( 2, 2, false, 2, 1, 0 ); // $ExpectError
153+
iladlr.ndarray( 2, 2, null, 2, 1, 0 ); // $ExpectError
154+
iladlr.ndarray( 2, 2, void 0, 2, 1, 0 ); // $ExpectError
155+
iladlr.ndarray( 2, 2, [], 2, 1, 0 ); // $ExpectError
156+
iladlr.ndarray( 2, 2, {}, 2, 1, 0 ); // $ExpectError
157+
iladlr.ndarray( 2, 2, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError
158+
}
159+
160+
// The compiler throws an error if the function is provided a fourth argument which is not a number...
161+
{
162+
const A = new Float64Array( 4 );
163+
164+
iladlr.ndarray( 2, 2, A, '5', 1, 0 ); // $ExpectError
165+
iladlr.ndarray( 2, 2, A, true, 1, 0 ); // $ExpectError
166+
iladlr.ndarray( 2, 2, A, false, 1, 0 ); // $ExpectError
167+
iladlr.ndarray( 2, 2, A, null, 1, 0 ); // $ExpectError
168+
iladlr.ndarray( 2, 2, A, void 0, 1, 0 ); // $ExpectError
169+
iladlr.ndarray( 2, 2, A, [], 1, 0 ); // $ExpectError
170+
iladlr.ndarray( 2, 2, A, {}, 1, 0 ); // $ExpectError
171+
iladlr.ndarray( 2, 2, A, ( x: number ): number => x, 1, 0 ); // $ExpectError
172+
}
173+
174+
// The compiler throws an error if the function is provided a fifth argument which is not a number...
175+
{
176+
const A = new Float64Array( 4 );
177+
178+
iladlr.ndarray( 2, 2, A, 2, '5', 0 ); // $ExpectError
179+
iladlr.ndarray( 2, 2, A, 2, true, 0 ); // $ExpectError
180+
iladlr.ndarray( 2, 2, A, 2, false, 0 ); // $ExpectError
181+
iladlr.ndarray( 2, 2, A, 2, null, 0 ); // $ExpectError
182+
iladlr.ndarray( 2, 2, A, 2, void 0, 0 ); // $ExpectError
183+
iladlr.ndarray( 2, 2, A, 2, [], 0 ); // $ExpectError
184+
iladlr.ndarray( 2, 2, A, 2, {}, 0 ); // $ExpectError
185+
iladlr.ndarray( 2, 2, A, 2, ( x: number ): number => x, 0 ); // $ExpectError
186+
}
187+
188+
// The compiler throws an error if the function is provided a sixth argument which is not a number...
189+
{
190+
const A = new Float64Array( 4 );
191+
192+
iladlr.ndarray( 2, 2, A, 2, 1, '5' ); // $ExpectError
193+
iladlr.ndarray( 2, 2, A, 2, 1, true ); // $ExpectError
194+
iladlr.ndarray( 2, 2, A, 2, 1, false ); // $ExpectError
195+
iladlr.ndarray( 2, 2, A, 2, 1, null ); // $ExpectError
196+
iladlr.ndarray( 2, 2, A, 2, 1, void 0 ); // $ExpectError
197+
iladlr.ndarray( 2, 2, A, 2, 1, [] ); // $ExpectError
198+
iladlr.ndarray( 2, 2, A, 2, 1, {} ); // $ExpectError
199+
iladlr.ndarray( 2, 2, A, 2, 1, ( x: number ): number => x ); // $ExpectError
200+
}
201+
202+
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments (6-argument version)...
203+
{
204+
const A = new Float64Array( 4 );
205+
206+
iladlr.ndarray(); // $ExpectError
207+
iladlr.ndarray( 2 ); // $ExpectError
208+
iladlr.ndarray( 2, 2 ); // $ExpectError
209+
iladlr.ndarray( 2, 2, A ); // $ExpectError
210+
iladlr.ndarray( 2, 2, A, 2 ); // $ExpectError
211+
iladlr.ndarray( 2, 2, A, 2, 1 ); // $ExpectError
212+
iladlr.ndarray( 2, 2, A, 2, 1, 0, 10 ); // $ExpectError
213+
}

0 commit comments

Comments
 (0)