Exemplo n.º 1
0
	test( title , t => {

		var a = new ctor( n ) ;

		iota( a , 0 , n , 0 ) ;

		shuffle( a , 0 , n ) ;

		makeheap( arity , compare , swap , a , 0 , n ) ;

		t.deepEqual( a.length , n , "size stays the same" ) ;

		var out = [ ] ;

		var i = n ;

		while ( i-- ) {

			out.push( pop( arity , compare , swap , a , 0 , i + 1 ) ) ;

		}

		t.deepEqual( issorted( compare , out , 0 , n ) , n , "output is sorted" ) ;

	} ) ;
Exemplo n.º 2
0
	test( title, t => {

		// SETUP ARRAY
		const a = new ctor(n);
		iota( a, 0, n, 0 );

		// SORT ARRAY
		shuffle( a, 0, n );
		arraysort( compare, a );

		t.is( sort.issorted( compare , a , 0 , n ) , n , "check sorted" );
		t.is( a.length, n, "check length a" );

	} );