Skip to content

Commit ad201c7

Browse files
committed
chore: add test cases
--- 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: 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 9224753 commit ad201c7

File tree

1 file changed

+123
-2
lines changed

1 file changed

+123
-2
lines changed

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

Lines changed: 123 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
8383
t.end();
8484
});
8585

86-
tape( 'the function supports an `x` stride', function test( t ) {
86+
tape( 'the function supports a `x` stride', function test( t ) {
8787
var expected;
8888
var dot;
8989
var x;
@@ -115,7 +115,67 @@ tape( 'the function supports an `x` stride', function test( t ) {
115115
t.end();
116116
});
117117

118-
tape( 'the function supports an `y` stride', function test( t ) {
118+
tape( 'the function supports a negative `x` stride', function test( t ) {
119+
var expected;
120+
var dot;
121+
var x;
122+
var y;
123+
124+
x = new Complex128Array([
125+
-1, // 1
126+
-9, // 1
127+
7, // 0
128+
-8, // 0
129+
-4,
130+
-7,
131+
2,
132+
-8
133+
]);
134+
y = new Complex128Array([
135+
6, // 0
136+
-6, // 0
137+
-9, // 1
138+
5, // 1
139+
7,
140+
-6,
141+
1,
142+
-5
143+
]);
144+
expected = new Complex128( 54, -80 );
145+
dot = zdotc( 2, x, -1, 1, y, 1, 0 );
146+
t.deepEqual( dot, expected, 'returns expected value' );
147+
t.end();
148+
});
149+
150+
tape( 'the function supports a `x` offset', function test( t ) {
151+
var expected;
152+
var dot;
153+
var x;
154+
var y;
155+
156+
x = new Complex128Array([
157+
0.0,
158+
0.0,
159+
1.0, // 0
160+
2.0, // 0
161+
3.0, // 1
162+
4.0 // 1
163+
]);
164+
y = new Complex128Array([
165+
-5.0, // 0
166+
1.0, // 0
167+
-6.0, // 1
168+
7.0 // 1
169+
]);
170+
expected = new Complex128( 7.0, 56.0 );
171+
172+
dot = zdotc( 2, x, 1, 1, y, 1, 0 );
173+
t.deepEqual( dot, expected, 'returns expected value' );
174+
175+
t.end();
176+
});
177+
178+
tape( 'the function supports a `y` stride', function test( t ) {
119179
var expected;
120180
var dot;
121181
var x;
@@ -148,6 +208,67 @@ tape( 'the function supports an `y` stride', function test( t ) {
148208
t.end();
149209
});
150210

211+
tape( 'the function supports a negative `y` stride', function test( t ) {
212+
var expected;
213+
var dot;
214+
var x;
215+
var y;
216+
217+
x = new Complex128Array([
218+
7, // 0
219+
-8, // 0
220+
-4, // 1
221+
-7, // 1
222+
-1,
223+
-9,
224+
2,
225+
-8
226+
]);
227+
y = new Complex128Array([
228+
7, // 1
229+
-6, // 1
230+
6, // 0
231+
-6, // 0
232+
-9,
233+
5,
234+
1,
235+
-5
236+
]);
237+
expected = new Complex128( 104, 79 );
238+
239+
dot = zdotc( 2, x, 1, 0, y, -1, 1 );
240+
t.deepEqual( dot, expected, 'returns expected value' );
241+
t.end();
242+
});
243+
244+
tape( 'the function supports a `y` offset', function test( t ) {
245+
var expected;
246+
var dot;
247+
var x;
248+
var y;
249+
250+
x = new Complex128Array([
251+
1.0, // 0
252+
2.0, // 0
253+
3.0, // 1
254+
4.0 // 1
255+
]);
256+
y = new Complex128Array([
257+
0.0,
258+
0.0,
259+
-5.0, // 0
260+
1.0, // 0
261+
-6.0, // 1
262+
7.0 // 1
263+
]);
264+
expected = new Complex128( 7.0, 56.0 );
265+
266+
dot = zdotc( 2, x, 1, 0, y, 1, 1 );
267+
t.deepEqual( dot, expected, 'returns expected value' );
268+
269+
t.end();
270+
});
271+
151272
tape( 'the function supports negative strides', function test( t ) {
152273
var expected;
153274
var dot;

0 commit comments

Comments
 (0)