Skip to content

Commit f47e96c

Browse files
committed
test: add signed zero tests
--- 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 20fa8c1 commit f47e96c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/node_modules/@stdlib/blas/ext/base/gsum/test/test.ndarray.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25+
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
2526
var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
2627
var gsum = require( './../lib/ndarray.js' );
2728

@@ -93,6 +94,17 @@ tape( 'the function calculates the sum of all strided array elements', function
9394
t.end();
9495
});
9596

97+
tape( 'the function preserves the sign of zero', function test( t ) {
98+
var x;
99+
var v;
100+
101+
x = [ -0.0, -0.0, -0.0, -0.0, -0.0 ];
102+
v = gsum( x.length, x, 1, 0 );
103+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
104+
105+
t.end();
106+
});
107+
96108
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
97109
var x;
98110
var v;

0 commit comments

Comments
 (0)