2121// MODULES //
2222
2323var tape = require ( 'tape' ) ;
24- var gamma = require ( 'gamma' ) ; // eslint-disable-line stdlib/ require-file-extensions
24+ var tryRequire = require ( '@stdlib/utils/try- require' ) ;
2525var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2626var incrspace = require ( '@stdlib/array/base/incrspace' ) ;
2727var abs = require ( '@stdlib/math/base/special/abs' ) ;
@@ -30,6 +30,14 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
3030var NINF = require ( '@stdlib/constants/float64/ninf' ) ;
3131
3232
33+ // VARIABLES //
34+
35+ var gamma = tryRequire ( 'gamma' ) ;
36+ var opts = {
37+ 'skip' : ( gamma instanceof Error )
38+ } ;
39+
40+
3341// FIXTURES //
3442
3543var data1 = require ( './../fixtures/r/data1.json' ) ;
@@ -40,13 +48,13 @@ var expected2 = require( './../fixtures/r/expected2.json' );
4048
4149// TESTS //
4250
43- tape ( 'main export is a function' , function test ( t ) {
51+ tape ( 'main export is a function' , opts , function test ( t ) {
4452 t . ok ( true , __filename ) ;
4553 t . strictEqual ( typeof gamma , 'function' , 'main export is a function' ) ;
4654 t . end ( ) ;
4755} ) ;
4856
49- tape ( 'if provided a negative integer, the function returns `NaN`' , function test ( t ) {
57+ tape ( 'if provided a negative integer, the function returns `NaN`' , opts , function test ( t ) {
5058 var values = incrspace ( - 1.0 , - 1000.0 , - 1.0 ) ;
5159 var v ;
5260 var i ;
@@ -58,31 +66,31 @@ tape( 'if provided a negative integer, the function returns `NaN`', function tes
5866 t . end ( ) ;
5967} ) ;
6068
61- tape ( 'if provided negative infinity, the function returns `NaN`' , function test ( t ) {
69+ tape ( 'if provided negative infinity, the function returns `NaN`' , opts , function test ( t ) {
6270 var v = gamma ( NINF ) ;
6371 t . strictEqual ( isnan ( v ) , true , 'returns NaN when provided negative infinity' ) ;
6472 t . end ( ) ;
6573} ) ;
6674
67- tape ( 'if provided `NaN`, the function returns `NaN`' , function test ( t ) {
75+ tape ( 'if provided `NaN`, the function returns `NaN`' , opts , function test ( t ) {
6876 var v = gamma ( NaN ) ;
6977 t . strictEqual ( isnan ( v ) , true , 'returns NaN when provided a NaN' ) ;
7078 t . end ( ) ;
7179} ) ;
7280
73- tape ( 'if provided `-0`, the function returns negative infinity' , function test ( t ) {
81+ tape ( 'if provided `-0`, the function returns negative infinity' , opts , function test ( t ) {
7482 var v = gamma ( - 0.0 ) ;
7583 t . strictEqual ( v , NINF , 'returns -infinity' ) ;
7684 t . end ( ) ;
7785} ) ;
7886
79- tape ( 'if provided `+0`, the function returns positive infinity' , function test ( t ) {
87+ tape ( 'if provided `+0`, the function returns positive infinity' , opts , function test ( t ) {
8088 var v = gamma ( 0.0 ) ;
8189 t . strictEqual ( v , PINF , 'returns +infinity' ) ;
8290 t . end ( ) ;
8391} ) ;
8492
85- tape ( 'if `x > 171.6144...`, the function returns positive infinity' , function test ( t ) {
93+ tape ( 'if `x > 171.6144...`, the function returns positive infinity' , opts , function test ( t ) {
8694 var values = incrspace ( 172.0 , 1000.0 , 10.1234 ) ;
8795 var v ;
8896 var i ;
@@ -94,7 +102,7 @@ tape( 'if `x > 171.6144...`, the function returns positive infinity', function t
94102 t . end ( ) ;
95103} ) ;
96104
97- tape ( 'if `x < -170.56749...`, the function returns positive infinity' , function test ( t ) {
105+ tape ( 'if `x < -170.56749...`, the function returns positive infinity' , opts , function test ( t ) {
98106 var values = incrspace ( - 170.57 , - 1000.0 , - 10.1234 ) ;
99107 var v ;
100108 var i ;
@@ -106,7 +114,7 @@ tape( 'if `x < -170.56749...`, the function returns positive infinity', function
106114 t . end ( ) ;
107115} ) ;
108116
109- tape ( 'the function evaluates the gamma function (positive integers)' , function test ( t ) {
117+ tape ( 'the function evaluates the gamma function (positive integers)' , opts , function test ( t ) {
110118 var delta ;
111119 var tol ;
112120 var v ;
@@ -121,7 +129,7 @@ tape( 'the function evaluates the gamma function (positive integers)', function
121129 t . end ( ) ;
122130} ) ;
123131
124- tape ( 'the function evaluates the gamma function (decimal values)' , function test ( t ) {
132+ tape ( 'the function evaluates the gamma function (decimal values)' , opts , function test ( t ) {
125133 var delta ;
126134 var tol ;
127135 var v ;
@@ -136,7 +144,7 @@ tape( 'the function evaluates the gamma function (decimal values)', function tes
136144 t . end ( ) ;
137145} ) ;
138146
139- tape ( 'if provided a positive integer, the function returns the factorial of (n-1)' , function test ( t ) {
147+ tape ( 'if provided a positive integer, the function returns the factorial of (n-1)' , opts , function test ( t ) {
140148 t . strictEqual ( gamma ( 4.0 ) , 6.0 , 'returns 6' ) ;
141149 t . strictEqual ( gamma ( 5.0 ) , 24.0 , 'returns 24' ) ;
142150 t . strictEqual ( gamma ( 6.0 ) , 120.0 , 'returns 120' ) ;
0 commit comments