Skip to content

Commit 54d4772

Browse files
committed
test: use correct expected values
1 parent 2274f73 commit 54d4772

File tree

1 file changed

+11
-6
lines changed
  • lib/node_modules/@stdlib/math/base/special/kernel-cos/test

1 file changed

+11
-6
lines changed

lib/node_modules/@stdlib/math/base/special/kernel-cos/test/test.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var rempio2 = require( '@stdlib/math/base/special/rempio2' );
26-
var cos = require( '@stdlib/math/base/special/cos' );
2726
var kernelCos = require( './../lib' );
2827

2928

@@ -55,21 +54,24 @@ tape( 'the function returns `NaN` if provided `NaN` for either parameter', funct
5554
});
5655

5756
tape( 'the function evaluates the cosine for input values on the interval `[-pi/4, pi/4]`', function test( t ) {
57+
var expected;
5858
var values;
5959
var out;
6060
var x;
6161
var i;
6262

6363
values = smallRange.x;
64+
expected = smallRange.expected;
6465
for ( i = 0; i < values.length; i++ ) {
6566
x = values[ i ];
6667
out = kernelCos( x, 0.0 );
67-
t.strictEqual( out, cos( x ), 'returns expected value' );
68+
t.strictEqual( out, expected[ i ], 'returns expected value' );
6869
}
6970
t.end();
7071
});
7172

7273
tape( 'the function can be used to compute the cosine for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (positive)', function test( t ) {
74+
var expected;
7375
var values;
7476
var out;
7577
var x;
@@ -78,18 +80,19 @@ tape( 'the function can be used to compute the cosine for input values outside o
7880
var i;
7981

8082
values = largePositive.x;
83+
expected = largePositive.expected;
8184
y = new Array( 2 );
8285
for ( i = 0; i < values.length; i++ ) {
8386
x = values[ i ];
8487
n = rempio2( x, y );
8588
switch ( n & 3 ) {
8689
case 0:
8790
out = kernelCos( y[ 0 ], y[ 1 ] );
88-
t.strictEqual( out, cos( x ), 'returns expected value' );
91+
t.strictEqual( out, expected[ i ], 'returns expected value' );
8992
break;
9093
case 2:
9194
out = -kernelCos( y[ 0 ], y[ 1 ] );
92-
t.strictEqual( out, cos( x ), 'returns expected value' );
95+
t.strictEqual( out, expected[ i ], 'returns expected value' );
9396
break;
9497
default:
9598
break;
@@ -99,6 +102,7 @@ tape( 'the function can be used to compute the cosine for input values outside o
99102
});
100103

101104
tape( 'the function can be used to compute the cosine for input values outside of `[-pi/4, pi/4]` after argument reduction via `rempio2` (negative)', function test( t ) {
105+
var expected;
102106
var values;
103107
var out;
104108
var x;
@@ -107,18 +111,19 @@ tape( 'the function can be used to compute the cosine for input values outside o
107111
var i;
108112

109113
values = largeNegative.x;
114+
expected = largeNegative.expected;
110115
y = new Array( 2 );
111116
for ( i = 0; i < values.length; i++ ) {
112117
x = values[ i ];
113118
n = rempio2( x, y );
114119
switch ( n & 3 ) {
115120
case 0:
116121
out = kernelCos( y[ 0 ], y[ 1 ] );
117-
t.strictEqual( out, cos( x ), 'returns expected value' );
122+
t.strictEqual( out, expected[ i ], 'returns expected value' );
118123
break;
119124
case 2:
120125
out = -kernelCos( y[ 0 ], y[ 1 ] );
121-
t.strictEqual( out, cos( x ), 'returns expected value' );
126+
t.strictEqual( out, expected[ i ], 'returns expected value' );
122127
break;
123128
default:
124129
break;

0 commit comments

Comments
 (0)