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

@@ -1,8 +1,66 @@
+/* eslint-disable object-curly-newline, no-unused-vars */%0A
 'use str
@@ -537,16 +537,17 @@
 %09%5B%5D,%0A%09%09%7B
+ 
 'length'
@@ -550,16 +550,17 @@
 gth': 10
+ 
 %7D,%0A%09%09'be
@@ -866,32 +866,33 @@
 t ) %7B%0A%09var o = %7B
+ 
 'length': UINT32
@@ -897,16 +897,17 @@
 32_MAX+1
+ 
 %7D;%0A%09t.eq
@@ -1104,32 +1104,33 @@
 t ) %7B%0A%09var o = %7B
+ 
 'length': 3.14%7D;
@@ -1127,16 +1127,17 @@
 h': 3.14
+ 
 %7D;%0A%09t.eq
@@ -1346,16 +1346,17 @@
 ar o = %7B
+ 
 'length'
@@ -1359,16 +1359,17 @@
 gth': -1
+ 
 %7D;%0A%09t.eq

Fix lint errors