Skip to content

Commit 725bf51

Browse files
committed
test: completes code coverage in blas/base/dnrm2
--- 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 d7583fb commit 725bf51

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,30 @@ tape( 'the function calculates the L2-norm of a vector', function test( t ) {
5656
t.end();
5757
});
5858

59+
tape( 'the function calculates the L2-norm of a vector ( large value ) ', function test( t ) {
60+
var x;
61+
var z;
62+
63+
x = new Float64Array( [ 1.0, 2.0e147, -4.0, 5.0, 0.0, 3.0 ] );
64+
65+
z = dnrm2( x.length, x, 1, 0 );
66+
t.strictEqual( z, 2.0e147, 'returns expected value' );
67+
68+
t.end();
69+
});
70+
71+
tape( 'the function calculates the L2-norm of a vector ( tiny value ) ', function test( t ) {
72+
var x;
73+
var z;
74+
75+
x = new Float64Array( [ 1.0, 3.0e-154, -4.0, 5.0, 0.0, 3.0 ] );
76+
77+
z = dnrm2( x.length, x, 1, 0 );
78+
t.strictEqual( z, sqrt( 51.0 ), 'returns expected value' );
79+
80+
t.end();
81+
});
82+
5983
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) {
6084
var x;
6185
var z;

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ tape( 'the function calculates the L2-norm of a vector', opts, function test( t
6565
t.end();
6666
});
6767

68+
tape( 'the function calculates the L2-norm of a vector ( large value ) ', function test( t ) {
69+
var x;
70+
var z;
71+
72+
x = new Float64Array( [ 1.0, 2.0e147, -4.0, 5.0, 0.0, 3.0 ] );
73+
74+
z = dnrm2( x.length, x, 1, 0 );
75+
t.strictEqual( z, 2.0e147, 'returns expected value' );
76+
77+
t.end();
78+
});
79+
80+
tape( 'the function calculates the L2-norm of a vector ( tiny value ) ', function test( t ) {
81+
var x;
82+
var z;
83+
84+
x = new Float64Array( [ 1.0, 3.0e-154, -4.0, 5.0, 0.0, 3.0 ] );
85+
86+
z = dnrm2( x.length, x, 1, 0 );
87+
t.strictEqual( z, sqrt( 51.0 ), 'returns expected value' );
88+
89+
t.end();
90+
});
91+
6892
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
6993
var x;
7094
var z;

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,30 @@ tape( 'the function calculates the L2-norm of a vector', function test( t ) {
5656
t.end();
5757
});
5858

59+
tape( 'the function calculates the L2-norm of a vector ( large value ) ', function test( t ) {
60+
var x;
61+
var z;
62+
63+
x = new Float64Array( [ 1.0, 2.0e147, -4.0, 5.0, 0.0, 3.0 ] );
64+
65+
z = dnrm2( x.length, x, 1, 0 );
66+
t.strictEqual( z, 2.0e147, 'returns expected value' );
67+
68+
t.end();
69+
});
70+
71+
tape( 'the function calculates the L2-norm of a vector ( tiny value ) ', function test( t ) {
72+
var x;
73+
var z;
74+
75+
x = new Float64Array( [ 1.0, 3.0e-154, -4.0, 5.0, 0.0, 3.0 ] );
76+
77+
z = dnrm2( x.length, x, 1, 0 );
78+
t.strictEqual( z, sqrt( 51.0 ), 'returns expected value' );
79+
80+
t.end();
81+
});
82+
5983
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) {
6084
var x;
6185
var z;

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ tape( 'the function calculates the L2-norm of a vector', opts, function test( t
6565
t.end();
6666
});
6767

68+
tape( 'the function calculates the L2-norm of a vector ( large value ) ', function test( t ) {
69+
var x;
70+
var z;
71+
72+
x = new Float64Array( [ 1.0, 2.0e147, -4.0, 5.0, 0.0, 3.0 ] );
73+
74+
z = dnrm2( x.length, x, 1, 0 );
75+
t.strictEqual( z, 2.0e147, 'returns expected value' );
76+
77+
t.end();
78+
});
79+
80+
tape( 'the function calculates the L2-norm of a vector ( tiny value ) ', function test( t ) {
81+
var x;
82+
var z;
83+
84+
x = new Float64Array( [ 1.0, 3.0e-154, -4.0, 5.0, 0.0, 3.0 ] );
85+
86+
z = dnrm2( x.length, x, 1, 0 );
87+
t.strictEqual( z, sqrt( 51.0 ), 'returns expected value' );
88+
89+
t.end();
90+
});
91+
6892
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
6993
var x;
7094
var z;

0 commit comments

Comments
 (0)