@@ -0,0 +1,1451 @@
+/*-%0A * Copyright (c) 2014 Mikolaj Izdebski%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.lbzip2.impl;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.lbzip2.impl.Utils.insertion_sort;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Random;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * @author Mikolaj Izdebski%0A */%0Apublic class UtilsTest%0A%7B%0A    private final Random r = new Random( 7541 );%0A%0A    @Test%0A    public void testInsertionSort()%0A    %7B%0A        for ( int nRep = 0; nRep %3C 1000; nRep++ )%0A        %7B%0A            int n = 50 + r.nextInt( 100 );%0A            long%5B%5D A = new long%5Bn%5D;%0A            for ( int i = 0; i %3C n; i++ )%0A                A%5Bi%5D = r.nextLong();%0A%0A            long%5B%5D B = new long%5Bn%5D;%0A            System.arraycopy( A, 0, B, 0, n );%0A            Arrays.sort( B );%0A%0A            insertion_sort( A, 0, n );%0A%0A            for ( int i = 0; i %3C n; i++ )%0A                assertEquals( B%5Bn - i - 1%5D, A%5Bi%5D );%0A        %7D%0A    %7D%0A%7D

Add unit test for insertion sort