'use strict';

// MODULES //

var tape = require( 'tape' );
var factorial = require( '@stdlib/math/base/special/factorial' );
var incrspace = require( '@stdlib/math/utils/incrspace' );
var isnan = require( '@stdlib/assert/is-nan' );
var ldexp = require( '@stdlib/math/base/special/ldexp' );
var pow = require( '@stdlib/math/base/special/pow' );
var abs = require( '@stdlib/math/base/special/abs' );
var NINF = require( '@stdlib/math/constants/float64-ninf' );
var PINF = require( '@stdlib/math/constants/float64-pinf' );
var EPS = require( '@stdlib/math/constants/float64-eps' );
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();
});


'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();
});


Remove unused require statements