Skip to content

Commit f7249fe

Browse files
Shabareesh ShettyShabareesh Shetty
authored andcommitted
fix: update 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 742cf4d commit f7249fe

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.main.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
var tape = require( 'tape' );
2626
var Memory = require( '@stdlib/wasm/memory' );
27+
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
2728
var Complex128Array = require( '@stdlib/array/complex128' );
2829
var Float64Array = require( '@stdlib/array/float64' );
2930
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -241,7 +242,7 @@ tape( 'a module instance has a `main` method which supports specifying a negativ
241242
t.end();
242243
});
243244

244-
tape( 'a module instance has a `main` method which returns a reference to the input array', function test( t ) {
245+
tape( 'a module instance has an `ndarray` method which returns a pointer to the output array', function test( t ) {
245246
var mem;
246247
var mod;
247248
var out;
@@ -267,9 +268,10 @@ tape( 'a module instance has a `main` method which returns a reference to the in
267268
});
268269

269270
tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has a `main` method which leaves the input array unchanged', function test( t ) {
271+
var expected;
272+
var actual;
270273
var mem;
271274
var mod;
272-
var out;
273275
var ap;
274276
var xp;
275277

@@ -279,17 +281,23 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance
279281
mod = new Module( mem );
280282
mod.initializeSync();
281283

282-
xp = 0;
283-
ap = 48;
284+
xp = 48;
285+
ap = 0;
284286

285287
mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) );
286288
mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) );
287289

288-
out = mod.main( 0, ap, xp, 1 );
289-
t.strictEqual( out, xp, 'returns expected value' );
290+
expected = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] );
290291

291-
out = mod.main( -1, ap, xp, 1 );
292-
t.strictEqual( out, xp, 'returns expected value' );
292+
mod.main( 0, ap, xp, 1 );
293+
actual = new Complex128Array( 3 );
294+
mod.read( xp, actual );
295+
t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' );
296+
297+
mod.main( -1, ap, xp, 1 );
298+
actual = new Complex128Array( 3 );
299+
mod.read( xp, actual );
300+
t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' );
293301

294302
t.end();
295303
});

lib/node_modules/@stdlib/blas/base/wasm/zscal/test/test.module.ndarray.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
var tape = require( 'tape' );
2626
var Memory = require( '@stdlib/wasm/memory' );
27+
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
2728
var Complex128Array = require( '@stdlib/array/complex128' );
2829
var Float64Array = require( '@stdlib/array/float64' );
2930
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -305,7 +306,7 @@ tape( 'a module instance has an `ndarray` method which supports a `x` offset', f
305306
t.end();
306307
});
307308

308-
tape( 'a module instance has an `ndarray` method which returns a reference to the input array', function test( t ) {
309+
tape( 'a module instance has an `ndarray` method which returns a pointer to the output array', function test( t ) {
309310
var mem;
310311
var mod;
311312
var out;
@@ -331,9 +332,10 @@ tape( 'a module instance has an `ndarray` method which returns a reference to th
331332
});
332333

333334
tape( 'if provided an `N` parameter less than or equal to `0`, a module instance has an `ndarray` method which leaves the input array unchanged', function test( t ) {
335+
var expected;
336+
var actual;
334337
var mem;
335338
var mod;
336-
var out;
337339
var ap;
338340
var xp;
339341

@@ -343,17 +345,23 @@ tape( 'if provided an `N` parameter less than or equal to `0`, a module instance
343345
mod = new Module( mem );
344346
mod.initializeSync();
345347

346-
xp = 0;
347-
ap = 24;
348+
xp = 48;
349+
ap = 0;
348350

349351
mod.write( xp, new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] ) );
350352
mod.write( ap, new Float64Array( [ 0.4, -0.7 ] ) );
351353

352-
out = mod.ndarray( 0, ap, xp, 1, 0 );
353-
t.strictEqual( out, xp, 'returns expected value' );
354+
expected = new Complex128Array( [ 0.3, 0.1, 0.5, 0.0, 0.0, 0.5 ] );
354355

355-
out = mod.ndarray( -1, ap, xp, 1, 0 );
356-
t.strictEqual( out, xp, 'returns expected value' );
356+
mod.ndarray( 0, ap, xp, 1, 0 );
357+
actual = new Complex128Array( 3 );
358+
mod.read( xp, actual );
359+
t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' );
360+
361+
mod.ndarray( -1, ap, xp, 1, 0 );
362+
actual = new Complex128Array( 3 );
363+
mod.read( xp, actual );
364+
t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' );
357365

358366
t.end();
359367
});

0 commit comments

Comments
 (0)