Skip to content

Commit 74acecc

Browse files
authored
chore: add test cases
Signed-off-by: Shabareesh Shetty <[email protected]>
1 parent 4c7f204 commit 74acecc

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

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

Lines changed: 67 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,39 @@ 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, y, 1 );
146+
t.deepEqual( dot, expected, 'returns expected value' );
147+
t.end();
148+
});
149+
150+
tape( 'the function supports a `y` stride', function test( t ) {
119151
var expected;
120152
var dot;
121153
var x;
@@ -148,6 +180,39 @@ tape( 'the function supports an `y` stride', function test( t ) {
148180
t.end();
149181
});
150182

183+
tape( 'the function supports a negative `y` stride', function test( t ) {
184+
var expected;
185+
var dot;
186+
var x;
187+
var y;
188+
189+
x = new Complex128Array([
190+
7, // 0
191+
-8, // 0
192+
-4, // 1
193+
-7, // 1
194+
-1,
195+
-9,
196+
2,
197+
-8
198+
]);
199+
y = new Complex128Array([
200+
7, // 1
201+
-6, // 1
202+
6, // 0
203+
-6, // 0
204+
-9,
205+
5,
206+
1,
207+
-5
208+
]);
209+
expected = new Complex128( 104, 79 );
210+
211+
dot = zdotc( 2, x, 1 y, -1 );
212+
t.deepEqual( dot, expected, 'returns expected value' );
213+
t.end();
214+
});
215+
151216
tape( 'the function supports negative strides', function test( t ) {
152217
var expected;
153218
var dot;

0 commit comments

Comments
 (0)