Skip to content

Commit 691d52b

Browse files
committed
test: completes code coverage in blas/base/snrm2
--- 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 fcd86ae commit 691d52b

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,31 @@ tape( 'the function calculates the L2-norm of a vector', function test( t ) {
8383
z = snrm2( x.length, x, 1, 0 );
8484
isApprox( t, z, 4.0, 1.0 );
8585

86+
x = new Float32Array( [ 9e-20, 9e-20, 1.2e-19 ] );
87+
88+
z = snrm2( x.length, x, 1 );
89+
isApprox( t, z, 1.7492856287692852e-19, 1.0 );
90+
91+
x = new Float32Array( [ 1.0e-20, 1.0e-20, 1.0e-20, 1.0e-20 ] );
92+
93+
z = snrm2( x.length, x, 1 );
94+
isApprox( t, z, 1.999999936531045e-20, 1.0 );
95+
96+
x = new Float32Array( [ 1.0e20, 1.0e5, 1.0e20, 1.0e5 ] );
97+
98+
z = snrm2( x.length, x, 1, 0 );
99+
t.strictEqual( z, 141421358199525600000.0, 'returns expected value' );
100+
101+
x = new Float32Array( [ 1.0e-20, 1.0e5, 1.0e-20, 1.0e5 ] );
102+
103+
z = snrm2( x.length, x, 1, 0 );
104+
t.strictEqual( z, 141421.359375, 'returns expected value' );
105+
106+
x = new Float32Array( [ 1.4e-19, 1.5e-19, 1.4e-19, 0.0 ] );
107+
108+
z = snrm2( x.length, x, 1, 0 );
109+
isApprox( t, z, 2.4839484162537295e-19, 1.0 );
110+
86111
t.end();
87112
});
88113

lib/node_modules/@stdlib/blas/base/snrm2/test/test.ndarray.native.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@ tape( 'the function calculates the L2-norm of a vector', opts, function test( t
9292
z = snrm2( x.length, x, 1, 0 );
9393
isApprox( t, z, 4.0, 1.0 );
9494

95+
x = new Float32Array( [ 9e-20, 9e-20, 1.2e-19 ] );
96+
97+
z = snrm2( x.length, x, 1 );
98+
isApprox( t, z, 1.7492856287692852e-19, 1.0 );
99+
100+
x = new Float32Array( [ 1.0e-20, 1.0e-20, 1.0e-20, 1.0e-20 ] );
101+
102+
z = snrm2( x.length, x, 1 );
103+
isApprox( t, z, 1.999999936531045e-20, 1.0 );
104+
105+
x = new Float32Array( [ 1.0e20, 1.0e5, 1.0e20, 1.0e5 ] );
106+
107+
z = snrm2( x.length, x, 1, 0 );
108+
t.strictEqual( z, 141421358199525600000.0, 'returns expected value' );
109+
110+
x = new Float32Array( [ 1.0e-20, 1.0e5, 1.0e-20, 1.0e5 ] );
111+
112+
z = snrm2( x.length, x, 1, 0 );
113+
t.strictEqual( z, 141421.359375, 'returns expected value' );
114+
115+
x = new Float32Array( [ 1.4e-19, 1.5e-19, 1.4e-19, 0.0 ] );
116+
117+
z = snrm2( x.length, x, 1, 0 );
118+
isApprox( t, z, 2.4839484162537295e-19, 1.0 );
119+
95120
t.end();
96121
});
97122

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,31 @@ tape( 'the function calculates the L2-norm of a vector', function test( t ) {
8383
z = snrm2( x.length, x, 1 );
8484
isApprox( t, z, 4.0, 1.0 );
8585

86+
x = new Float32Array( [ 9e-20, 9e-20, 1.2e-19 ] );
87+
88+
z = snrm2( x.length, x, 1 );
89+
isApprox( t, z, 1.7492856287692852e-19, 1.0 );
90+
91+
x = new Float32Array( [ 1.0e-20, 1.0e-20, 1.0e-20, 1.0e-20 ] );
92+
93+
z = snrm2( x.length, x, 1 );
94+
isApprox( t, z, 1.999999936531045e-20, 1.0 );
95+
96+
x = new Float32Array( [ 1.0e20, 1.0e5, 1.0e20, 1.0e5 ] );
97+
98+
z = snrm2( x.length, x, 1, 0 );
99+
t.strictEqual( z, 141421358199525600000.0, 'returns expected value' );
100+
101+
x = new Float32Array( [ 1.0e-20, 1.0e5, 1.0e-20, 1.0e5 ] );
102+
103+
z = snrm2( x.length, x, 1, 0 );
104+
t.strictEqual( z, 141421.359375, 'returns expected value' );
105+
106+
x = new Float32Array( [ 1.4e-19, 1.5e-19, 1.4e-19, 0.0 ] );
107+
108+
z = snrm2( x.length, x, 1, 0 );
109+
isApprox( t, z, 2.4839484162537295e-19, 1.0 );
110+
86111
t.end();
87112
});
88113

lib/node_modules/@stdlib/blas/base/snrm2/test/test.snrm2.native.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@ tape( 'the function calculates the L2-norm of a vector', opts, function test( t
9292
z = snrm2( x.length, x, 1 );
9393
isApprox( t, z, 4.0, 1.0 );
9494

95+
x = new Float32Array( [ 9e-20, 9e-20, 1.2e-19 ] );
96+
97+
z = snrm2( x.length, x, 1 );
98+
isApprox( t, z, 1.7492856287692852e-19, 1.0 );
99+
100+
x = new Float32Array( [ 1.0e-20, 1.0e-20, 1.0e-20, 1.0e-20 ] );
101+
102+
z = snrm2( x.length, x, 1 );
103+
isApprox( t, z, 1.999999936531045e-20, 1.0 );
104+
105+
x = new Float32Array( [ 1.0e20, 1.0e5, 1.0e20, 1.0e5 ] );
106+
107+
z = snrm2( x.length, x, 1, 0 );
108+
t.strictEqual( z, 141421358199525600000.0, 'returns expected value' );
109+
110+
x = new Float32Array( [ 1.0e-20, 1.0e5, 1.0e-20, 1.0e5 ] );
111+
112+
z = snrm2( x.length, x, 1, 0 );
113+
t.strictEqual( z, 141421.359375, 'returns expected value' );
114+
115+
x = new Float32Array( [ 1.4e-19, 1.5e-19, 1.4e-19, 0.0 ] );
116+
117+
z = snrm2( x.length, x, 1, 0 );
118+
isApprox( t, z, 2.4839484162537295e-19, 1.0 );
119+
95120
t.end();
96121
});
97122

0 commit comments

Comments
 (0)