text: /* global describe, it, require */
  'use strict';
  
  // MODULES //
  
  var // Expectation library:
  	chai = require( 'chai' ),
  
  	// Check whether an element is a finite number
  	isFiniteNumber = require( 'validate.io-finite' ),
  
  	// Module to be tested:
  	quantile = require( './../lib/typedarray.js' );
  
  
  // VARIABLES //
  
  var expect = chai.expect,
  	assert = chai.assert;
  
  
  // TESTS //
  
  describe( 'typed-array quantile', function tests() {
  	var validationData = require( './fixtures/typedarray.json' ),
  		n = validationData.n,
  		p  = validationData.p ;
  
  	it( 'should export a function', function test() {
  		expect( quantile ).to.be.a( 'function' );
  	});
  
  	it( 'should evaluate the quantile function of the Binomial distribution', function test() {
  		var data, actual, expected, i;
  
  		data = new Float64Array( validationData.data );
  		actual = new Float64Array( data.length );
  
  		actual = quantile( actual, data, n, p  );
  
  		expected = new Float64Array( validationData.expected.map( function( d ) {
  			if (d === 'Inf' ) {
  				return Number.POSITIVE_INFINITY;
  			}
  			if ( d === '-Inf' ) {
  				return Number.NEGATIVE_INFINITY;
  			}
  			return d;
  		}) );
  
  		for ( i = 0; i < actual.length; i++ ) {
  			if ( isFiniteNumber( actual[ i ] )&& isFiniteNumber( expected[ i ] ) ) {
  				assert.closeTo( actual[ i ], expected[ i ], 1e-12 );
  			}
  		}
  	});
  
  	it( 'should return an empty array if provided an empty array', function test() {
  		assert.deepEqual( quantile( new Int8Array(), new Int8Array(), n, p  ), new Int8Array() );
  	});
  
  });
  