package com.stephenramthun.algorithms.sorting;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

class BubbleSortTest {

    @Test
    void testSorting() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] array = Utility.randomArray(n);
            BubbleSort.sort(array);
            assertTrue(Utility.isSorted(array));
        }
    }

    @Test
    void testPermutation() {
        int n = 1000;
        int r = 10;

        for (int i = 0; i < r; i++) {
            int[] a = Utility.randomArray(n);
            int[] b = Utility.copy(a);

            BubbleSort.sort(a);
            assertTrue(Utility.arePermutations(a, b));
        }
    }
}

@@ -99,16 +99,76 @@
 ertTrue;
+%0Aimport static org.junit.jupiter.api.Assertions.assertFalse;
 %0A%0Aimport
@@ -477,24 +477,232 @@
 );%0A        %7D
+%0A%0A        String%5B%5D strings = %7B%22cbc%22, %22abc%22, %22bbc%22, %22ccd%22, %22ccb%22, %22bbc%22, %22aab%22%7D;%0A        assertFalse(Utility.isSorted(strings));%0A        BubbleSort.sort(strings);%0A        assertTrue(Utility.isSorted(strings));
 %0A    %7D%0A%0A    

Add tests for arrays of Comparable objects.