Skip to content

Commit 5d61c88

Browse files
committed
test: update messages and assertions
1 parent aa37d2f commit 5d61c88

File tree

3 files changed

+41
-38
lines changed

3 files changed

+41
-38
lines changed

lib/node_modules/@stdlib/math/base/tools/evalpoly/test/test.factory.js

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,67 +33,70 @@ tape( 'main export is a function', function test( t ) {
3333
});
3434

3535
tape( 'the function returns a function', function test( t ) {
36-
var evalpoly = factory( [ 1.0, 2.0, 3.0 ] );
37-
t.equal( typeof evalpoly, 'function', 'returns a function' );
36+
var f = factory( [ 1.0, 2.0, 3.0 ] );
37+
t.strictEqual( typeof f, 'function', 'returns expected value' );
3838
t.end();
3939
});
4040

41-
tape( 'if provided an empty coefficient array, the generated `evalpoly` function always returns `0`', function test( t ) {
42-
var evalpoly = factory( [] );
41+
tape( 'if provided an empty coefficient array, the function returns a function which always returns `0`', function test( t ) {
42+
var f;
4343
var v;
4444
var i;
4545

46+
f = factory( [] );
4647
for ( i = 0; i < 100; i++ ) {
47-
v = evalpoly( i );
48-
t.equal( v, 0.0, 'returns 0' );
48+
v = f( i );
49+
t.strictEqual( v, 0.0, 'returns expected value' );
4950
}
5051
t.end();
5152
});
5253

53-
tape( 'if provided only 1 coefficient, the generated `evalpoly` function always returns that coefficient', function test( t ) {
54-
var evalpoly = factory( [2.0] );
54+
tape( 'if provided only 1 coefficient, the function returns a function which always returns that coefficient', function test( t ) {
55+
var f;
5556
var v;
5657
var i;
5758

59+
f = factory( [ 2.0 ] );
5860
for ( i = 0; i < 100; i++ ) {
59-
v = evalpoly( i );
60-
t.equal( v, 2.0, 'returns first coefficient' );
61+
v = f( i );
62+
t.strictEqual( v, 2.0, 'returns expected value' );
6163
}
6264
t.end();
6365
});
6466

65-
tape( 'if the value at which to evaluate a polynomial is `0`, the generated `evalpoly` function returns the first coefficient', function test( t ) {
66-
var evalpoly = factory( [ 3.0, 2.0, 1.0 ] );
67+
tape( 'if the value at which to evaluate a polynomial is `0`, the function returns a function which returns the first coefficient', function test( t ) {
68+
var f;
6769
var v;
6870

69-
v = evalpoly( 0.0 );
70-
t.equal( v, 3.0, 'returns first coefficient' );
71+
f = factory( [ 3.0, 2.0, 1.0 ] );
72+
v = f( 0.0 );
73+
t.strictEqual( v, 3.0, 'returns expected value' );
7174

7275
t.end();
7376
});
7477

75-
tape( 'the generated `evalpoly` function evaluates a polynomial', function test( t ) {
76-
var evalpoly;
78+
tape( 'the function returns a function which evaluates a polynomial', function test( t ) {
79+
var f;
7780
var v;
7881

79-
evalpoly = factory( [ 4.0, 5.0 ] );
80-
v = evalpoly( 6.0 );
81-
t.equal( v, 34.0, 'returns 34' );
82+
f = factory( [ 4.0, 5.0 ] );
83+
v = f( 6.0 );
84+
t.strictEqual( v, 34.0, 'returns expected value' );
8285

83-
evalpoly = factory( [ -4.0, -5.0 ] );
84-
v = evalpoly( 6.0 );
85-
t.equal( v, -34.0, 'returns -34' );
86+
f = factory( [ -4.0, -5.0 ] );
87+
v = f( 6.0 );
88+
t.strictEqual( v, -34.0, 'returns expected value' );
8689

87-
evalpoly = factory( [ -19.0, 7.0, -4.0, 6.0 ] );
88-
v = evalpoly( 3.0 );
89-
t.equal( v, 128.0, 'returns 128' );
90+
f = factory( [ -19.0, 7.0, -4.0, 6.0 ] );
91+
v = f( 3.0 );
92+
t.strictEqual( v, 128.0, 'returns expected value' );
9093

9194
t.end();
9295
});
9396

94-
tape( 'the generated `evalpoly` function evaluates a polynomial (large number of coefficients)', function test( t ) {
95-
var evalpoly;
97+
tape( 'the function returns a function which evaluates a polynomial (large number of coefficients)', function test( t ) {
9698
var sum;
99+
var f;
97100
var c;
98101
var v;
99102
var i;
@@ -104,10 +107,10 @@ tape( 'the generated `evalpoly` function evaluates a polynomial (large number of
104107
c.push( i );
105108
sum += i;
106109
}
107-
evalpoly = factory( c );
110+
f = factory( c );
108111

109-
v = evalpoly( 1.0 );
110-
t.equal( v, sum, 'returns expected value' );
112+
v = f( 1.0 );
113+
t.strictEqual( v, sum, 'returns expected value' );
111114

112115
t.end();
113116
});

lib/node_modules/@stdlib/math/base/tools/evalpoly/test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tape( 'main export is a function', function test( t ) {
3232
t.end();
3333
});
3434

35-
tape( 'attached to the main export is a factory method for generating `evalpoly` functions', function test( t ) {
36-
t.equal( typeof evalpoly.factory, 'function', 'exports a factory method' );
35+
tape( 'attached to the main export is a `factory` method', function test( t ) {
36+
t.strictEqual( typeof evalpoly.factory, 'function', 'has method' );
3737
t.end();
3838
});

lib/node_modules/@stdlib/math/base/tools/evalpoly/test/test.main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ tape( 'main export is a function', function test( t ) {
3434

3535
tape( 'if provided an empty coefficient array, the function returns `0`', function test( t ) {
3636
var v = evalpoly( [], 10.0 );
37-
t.equal( v, 0.0, 'returns 0' );
37+
t.strictEqual( v, 0.0, 'returns expected value' );
3838
t.end();
3939
});
4040

4141
tape( 'if provided only 1 coefficient, the function returns that coefficient', function test( t ) {
4242
var v = evalpoly( [ 1.0 ], 10.0 );
43-
t.equal( v, 1.0, 'returns first coefficient' );
43+
t.strictEqual( v, 1.0, 'returns expected value' );
4444
t.end();
4545
});
4646

4747
tape( 'if the value at which to evaluate a polynomial is `0`, the function returns the first coefficient', function test( t ) {
4848
var v = evalpoly( [ 3.0, 2.0, 1.0 ], 0.0 );
49-
t.equal( v, 3.0, 'returns first coefficient' );
49+
t.strictEqual( v, 3.0, 'returns expected value' );
5050
t.end();
5151
});
5252

@@ -56,15 +56,15 @@ tape( 'the function evaluates a polynomial', function test( t ) {
5656

5757
c = [ 4.0, 5.0 ];
5858
v = evalpoly( c, 6.0 );
59-
t.equal( v, 34.0, 'returns 34' );
59+
t.strictEqual( v, 34.0, 'returns expected value' );
6060

6161
c = [ -4.0, -5.0 ];
6262
v = evalpoly( c, 6.0 );
63-
t.equal( v, -34.0, 'returns -34' );
63+
t.strictEqual( v, -34.0, 'returns expected value' );
6464

6565
c = [ -19.0, 7.0, -4.0, 6.0 ];
6666
v = evalpoly( c, 3.0 );
67-
t.equal( v, 128.0, 'returns 128' );
67+
t.strictEqual( v, 128.0, 'returns expected value' );
6868

6969
t.end();
7070
});

0 commit comments

Comments
 (0)