'use strict';

// MODULES //

var tape = require( 'tape' );
var factorial = require( '@stdlib/math/base/special/factorial' );
var pow = require( '@stdlib/math/base/special/pow' );
var atinfinityplus = require( './../lib/atinfinityplus.js' );


// TESTS //

tape( 'main export is a function', function test( t ) {
	t.ok( true, __filename );
	t.strictEqual( typeof atinfinityplus, 'function', 'main export is a function' );
	t.end();
});

tape( 'if provided a large `x` and `n = 1`, the function returns `1/x`', function test( t ) {
	var x = 4.27e17;
	var val = atinfinityplus( 1, x );
	t.strictEqual( val, 1/x, 'returns 1/x' );

	x = 2.8e17;
	val = atinfinityplus( 1, x );
	t.strictEqual( val, 1/x, true, 'returns 1/x' );
	t.end();
});

tape( 'the function evaluates the polygamma function for large `x` and small `n` ', function test( t ) {
	var x = 4.27e17;
	var n = 3;
	var val = atinfinityplus( n, x );
	t.strictEqual( val, (1.0) * factorial( n - 1 ) * pow( x, -n ), 'returns expected value' );

	x = 4.27e17;
	n = 4;
	val = atinfinityplus( n, x );
	t.strictEqual( val, (-1.0) * factorial( n - 1 ) * pow( x, -n ), 'returns expected value' );

	t.end();
});


@@ -521,32 +521,47 @@
 est( t ) %7B%0A%09var 
+val;%0A%09var x;%0A%0A%09
 x = 4.27e17;%0A%09va
@@ -558,20 +558,16 @@
 27e17;%0A%09
-var 
 val = at
@@ -606,24 +606,26 @@
 qual( val, 1
+.0
 /x, 'returns
@@ -700,16 +700,18 @@
 ( val, 1
+.0
 /x, true
@@ -854,16 +854,39 @@
  %7B%0A%09var 
+val;%0A%09var x;%0A%09var n;%0A%0A%09
 x = 4.27
@@ -895,20 +895,16 @@
 7;%0A%09
-var 
 n = 3;%0A%09
 var 
@@ -899,20 +899,16 @@
 n = 3;%0A%09
-var 
 val = at
@@ -962,35 +962,33 @@
 ) * factorial( n
- - 
+-
 1 ) * pow( x, -n
@@ -1119,11 +1119,9 @@
 l( n
- - 
+-
 1 ) 

Add decimals