2020
2121// MODULES //
2222
23+ var resolve = require ( 'path' ) . resolve ;
2324var tape = require ( 'tape' ) ;
2425var PI = require ( '@stdlib/constants/float64/pi' ) ;
2526var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2627var NINF = require ( '@stdlib/constants/float64/ninf' ) ;
2728var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2829var isNegativeZero = require ( '@stdlib/math/base/assert/is-negative-zero' ) ;
2930var isPositiveZero = require ( '@stdlib/math/base/assert/is-positive-zero' ) ;
30- var ceilsd = require ( './../lib' ) ;
31+ var tryRequire = require ( '@stdlib/utils/try-require' ) ;
32+
33+
34+ // VARIABLES //
35+
36+ var ceilsd = tryRequire ( resolve ( __dirname , './../lib/native.js' ) ) ;
37+ var opts = {
38+ 'skip' : ( ceilsd instanceof Error )
39+ } ;
3140
3241
3342// TESTS //
3443
35- tape ( 'main export is a function' , function test ( t ) {
44+ tape ( 'main export is a function' , opts , function test ( t ) {
3645 t . ok ( true , __filename ) ;
3746 t . strictEqual ( typeof ceilsd , 'function' , 'main export is a function' ) ;
3847 t . end ( ) ;
3948} ) ;
4049
41- tape ( 'the function returns `NaN` if provided `NaN`' , function test ( t ) {
50+ tape ( 'the function returns `NaN` if provided `NaN`' , opts , function test ( t ) {
4251 var v ;
4352
4453 v = ceilsd ( NaN , 2 , 10 ) ;
45- t . strictEqual ( isnan ( v ) , true , 'returns NaN ' ) ;
54+ t . strictEqual ( isnan ( v ) , true , 'returns expected value ' ) ;
4655 t . end ( ) ;
4756} ) ;
4857
49- tape ( 'the function returns `NaN` if provided `n < 1`' , function test ( t ) {
58+ tape ( 'the function returns `NaN` if provided `n < 1`' , opts , function test ( t ) {
5059 var v ;
5160
5261 v = ceilsd ( PI , 0 , 10 ) ;
53- t . strictEqual ( isnan ( v ) , true , 'returns NaN ' ) ;
62+ t . strictEqual ( isnan ( v ) , true , 'returns expected value ' ) ;
5463
5564 v = ceilsd ( PI , - 1 , 10 ) ;
56- t . strictEqual ( isnan ( v ) , true , 'returns NaN ' ) ;
65+ t . strictEqual ( isnan ( v ) , true , 'returns expected value ' ) ;
5766
5867 t . end ( ) ;
5968} ) ;
6069
61- tape ( 'the function returns `NaN` if provided `b <= 0`' , function test ( t ) {
70+ tape ( 'the function returns `NaN` if provided `b <= 0`' , opts , function test ( t ) {
6271 var v ;
6372
6473 v = ceilsd ( PI , 2 , 0 ) ;
65- t . strictEqual ( isnan ( v ) , true , 'returns NaN ' ) ;
74+ t . strictEqual ( isnan ( v ) , true , 'returns expected value ' ) ;
6675
6776 v = ceilsd ( PI , 2 , - 1 ) ;
68- t . strictEqual ( isnan ( v ) , true , 'returns NaN ' ) ;
77+ t . strictEqual ( isnan ( v ) , true , 'returns expected value ' ) ;
6978
7079 t . end ( ) ;
7180} ) ;
7281
73- tape ( 'the function returns `+infinity` if provided `+infinity`' , function test ( t ) {
82+ tape ( 'the function returns `+infinity` if provided `+infinity`' , opts , function test ( t ) {
7483 var v = ceilsd ( PINF , 5 , 10 ) ;
7584 t . strictEqual ( v , PINF , 'returns +infinity' ) ;
7685 t . end ( ) ;
7786} ) ;
7887
79- tape ( 'the function returns `-infinity` if provided `-infinity`' , function test ( t ) {
88+ tape ( 'the function returns `-infinity` if provided `-infinity`' , opts , function test ( t ) {
8089 var v = ceilsd ( NINF , 3 , 10 ) ;
8190 t . strictEqual ( v , NINF , 'returns -infinity' ) ;
8291 t . end ( ) ;
8392} ) ;
8493
85- tape ( 'the function returns `-0` if provided `-0`' , function test ( t ) {
94+ tape ( 'the function returns `-0` if provided `-0`' , opts , function test ( t ) {
8695 var v ;
8796
8897 v = ceilsd ( - 0.0 , 1 , 10 ) ;
@@ -94,7 +103,7 @@ tape( 'the function returns `-0` if provided `-0`', function test( t ) {
94103 t . end ( ) ;
95104} ) ;
96105
97- tape ( 'the function returns `+0` if provided `+0`' , function test ( t ) {
106+ tape ( 'the function returns `+0` if provided `+0`' , opts , function test ( t ) {
98107 var v ;
99108
100109 v = ceilsd ( 0.0 , 1 , 10 ) ;
@@ -106,7 +115,7 @@ tape( 'the function returns `+0` if provided `+0`', function test( t ) {
106115 t . end ( ) ;
107116} ) ;
108117
109- tape ( 'the function supports rounding a numeric value with a specified number of significant figures (base 10)' , function test ( t ) {
118+ tape ( 'the function supports rounding a numeric value with a specified number of significant figures (base 10)' , opts , function test ( t ) {
110119 t . strictEqual ( ceilsd ( PI , 1 , 10 ) , 4.0 , 'returns expected value' ) ;
111120 t . strictEqual ( ceilsd ( - PI , 1 , 10 ) , - 3.0 , 'returns expected value' ) ;
112121 t . strictEqual ( ceilsd ( PI , 2 , 10 ) , 3.2 , 'returns expected value' ) ;
@@ -123,7 +132,7 @@ tape( 'the function supports rounding a numeric value with a specified number of
123132 t . end ( ) ;
124133} ) ;
125134
126- tape ( 'the function supports rounding a numeric value with a specified number of significant figures (base 2)' , function test ( t ) {
135+ tape ( 'the function supports rounding a numeric value with a specified number of significant figures (base 2)' , opts , function test ( t ) {
127136 t . strictEqual ( ceilsd ( 0.0313 , 1 , 2 ) , 0.0625 , 'returns expected value' ) ;
128137 t . strictEqual ( ceilsd ( 0.0313 , 2 , 2 ) , 0.046875 , 'returns expected value' ) ;
129138 t . strictEqual ( ceilsd ( 0.0313 , 3 , 2 ) , 0.0390625 , 'returns expected value' ) ;
@@ -141,13 +150,13 @@ tape( 'the function supports rounding a numeric value with a specified number of
141150 t . end ( ) ;
142151} ) ;
143152
144- tape ( 'the function supports rounding a numeric value with a specified number of significant figures using an arbitrary base' , function test ( t ) {
153+ tape ( 'the function supports rounding a numeric value with a specified number of significant figures using an arbitrary base' , opts , function test ( t ) {
145154 t . strictEqual ( ceilsd ( 0.0313 , 1 , 16 ) , 0.03515625 , 'returns expected value' ) ;
146155 t . strictEqual ( ceilsd ( 0.0313 , 5 , 16 ) , 0.03130000829696655 , 'returns expected value' ) ;
147156 t . end ( ) ;
148157} ) ;
149158
150- tape ( 'if the function encounters overflow, the function returns the input value' , function test ( t ) {
159+ tape ( 'if the function encounters overflow, the function returns the input value' , opts , function test ( t ) {
151160 var x ;
152161 var v ;
153162
0 commit comments