'use strict';

// MODULES //

var tape = require( 'tape' );
var UINT32_MAX = require( '@stdlib/math/constants/uint32-max' );
var isArrayLike = require( './../lib' );


// TESTS //

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

tape( 'the function returns `true` if provided an array-like object', function test( t ) {
	var values;
	var i;

	values = [
		[],
		{'length': 10},
		'beep',
		arguments
	];

	for ( i = 0; i < values.length; i++ ) {
		t.equal( isArrayLike( values[i] ), true, 'returns true when provided '+values[i] );
	}
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length exceeds the maximum array length', function test( t ) {
	var o = {'length': UINT32_MAX+1};
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length property is not an integer', function test( t ) {
	var o = {'length': 3.14};
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length property is a negative integer', function test( t ) {
	var o = {'length': -1};
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if not provided an array-like object', function test( t ) {
	var values;
	var i;

	values = [
		5,
		null,
		undefined,
		NaN,
		true,
		false,
		{},
		function boop( a, b, c ) {}
	];

	for ( i = 0; i < values.length; i++ ) {
		t.equal( isArrayLike( values[i] ), false, 'returns false when provided '+values[i] );
	}
	t.end();
});

/* eslint-disable object-curly-newline, no-unused-vars */
'use strict';

// MODULES //

var tape = require( 'tape' );
var UINT32_MAX = require( '@stdlib/math/constants/uint32-max' );
var isArrayLike = require( './../lib' );


// TESTS //

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

tape( 'the function returns `true` if provided an array-like object', function test( t ) {
	var values;
	var i;

	values = [
		[],
		{ 'length': 10 },
		'beep',
		arguments
	];

	for ( i = 0; i < values.length; i++ ) {
		t.equal( isArrayLike( values[i] ), true, 'returns true when provided '+values[i] );
	}
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length exceeds the maximum array length', function test( t ) {
	var o = { 'length': UINT32_MAX+1 };
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length property is not an integer', function test( t ) {
	var o = { 'length': 3.14 };
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if provided an array-like object whose length property is a negative integer', function test( t ) {
	var o = { 'length': -1 };
	t.equal( isArrayLike( o ), false, 'returns false' );
	t.end();
});

tape( 'the function returns `false` if not provided an array-like object', function test( t ) {
	var values;
	var i;

	values = [
		5,
		null,
		undefined,
		NaN,
		true,
		false,
		{},
		function boop( a, b, c ) {}
	];

	for ( i = 0; i < values.length; i++ ) {
		t.equal( isArrayLike( values[i] ), false, 'returns false when provided '+values[i] );
	}
	t.end();
});

Fix lint errors