Skip to content

Commit 9c2193f

Browse files
committed
test: add tests to achieve full coverage in math/base/special/tanh
--- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 26aa92d commit 9c2193f

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var tape = require( 'tape' );
24+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
25+
var evalrational = require( './../lib/rational_pq.js' );
26+
27+
28+
// TESTS //
29+
30+
tape( 'main export is a function', function test( t ) {
31+
t.ok( true, __filename );
32+
t.strictEqual( typeof evalrational, 'function', 'main export is a function' );
33+
t.end();
34+
});
35+
36+
tape( 'the function evaluates a rational function for x = 0', function test( t ) {
37+
var v = evalrational( 0.0 );
38+
t.strictEqual( v, -0.3333333333333332, 'returns expected value' );
39+
t.end();
40+
});
41+
42+
tape( 'the function evaluates a rational function for positive values', function test( t ) {
43+
var v;
44+
45+
v = evalrational( 0.5 );
46+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
47+
48+
v = evalrational( 1.0 );
49+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
50+
51+
v = evalrational( 2.0 );
52+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
53+
54+
t.end();
55+
});
56+
57+
tape( 'the function evaluates a rational function for negative values', function test( t ) {
58+
var v;
59+
60+
v = evalrational( -0.5 );
61+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
62+
63+
v = evalrational( -1.0 );
64+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
65+
66+
v = evalrational( -2.0 );
67+
t.strictEqual( isNumber( v ), true, 'returns expected value' );
68+
69+
t.end();
70+
});

0 commit comments

Comments
 (0)