// Path: Java-data-Structures/src/main/java/com/sorting/InsertionSort.java
// public class InsertionSort {
// 
//     /**
//      * Use the insertion sort method to sort the given array A
//      * 
//      * @param A Array of Comparable that contains the object to sort
//      */
//     public static void sort(Comparable[] A) {
//         if (A == null)
//             return;
//         Comparable curVal;
//         int j;
//         for (int i = 1; i < A.length; i++) {
//             curVal = A[i];
//             j = i - 1;
//             while ((j >= 0) && less(curVal, A[j])) {
//                 A[j + 1] = A[j];
//                 j--;
//             }
//             A[j + 1] = curVal;
//         }
//     }
// 
//     private static boolean less(Comparable a, Comparable b) {
//         int cmp = a.compareTo(b);
//         if (cmp < 0)
//             return true;
//         return false;
//     }
//     
// }


import com.sorting.InsertionSort;
import junit.framework.TestCase;
package com.test.sorting;



public class TestInsertionSort extends TestCase{

    public void testInsertionSort() {

        String[] A = { "zs", "qw", "qr", "miguel", "rtd", "fgs", "qq", "mk", "slao", "oiu", "vf", "xs", "er", "qw",
                "bv" };
        Integer[] B = { 2, 4, 7, 542, 0, 1, 3, 0, 6, 2, 7, 9, 10, 2, 4, 6, 0, 3, 2, 9, 2, 77, 33, 22, 5, 4, 2, 2, 2 };

        InsertionSort.sort(A);
// Path: Java-data-Structures/src/main/java/com/sorting/InsertionSort.java
// public class InsertionSort {
// 
//     /**
//      * Use the insertion sort method to sort the given array A
//      * 
//      * @param A Array of Comparable that contains the object to sort
//      */
//     public static void sort(Comparable[] A) {
//         if (A == null)
//             return;
//         Comparable curVal;
//         int j;
//         for (int i = 1; i < A.length; i++) {
//             curVal = A[i];
//             j = i - 1;
//             while ((j >= 0) && less(curVal, A[j])) {
//                 A[j + 1] = A[j];
//                 j--;
//             }
//             A[j + 1] = curVal;
//         }
//     }
// 
//     private static boolean less(Comparable a, Comparable b) {
//         int cmp = a.compareTo(b);
//         if (cmp < 0)
//             return true;
//         return false;
//     }
//     
// }


// Path: Java-data-Structures/src/test/java/com/test/sorting/TestInsertionSort.java
import com.sorting.InsertionSort;
import junit.framework.TestCase;

package com.test.sorting;



public class TestInsertionSort extends TestCase{

    public void testInsertionSort() {

        String[] A = { "zs", "qw", "qr", "miguel", "rtd", "fgs", "qq", "mk", "slao", "oiu", "vf", "xs", "er", "qw",
                "bv" };
        Integer[] B = { 2, 4, 7, 542, 0, 1, 3, 0, 6, 2, 7, 9, 10, 2, 4, 6, 0, 3, 2, 9, 2, 77, 33, 22, 5, 4, 2, 2, 2 };

        InsertionSort.sort(A);
        InsertionSort.sort(B);