|
| 1 | +/* |
| 2 | + * Copyright (C) 2022 Thoai |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +import com.rampatra.sorting.SelectionSort; |
| 19 | +import org.junit.jupiter.api.Test; |
| 20 | +import static org.junit.jupiter.api.Assertions.*; |
| 21 | + |
| 22 | +/** |
| 23 | + * |
| 24 | + * @author Thoai |
| 25 | + */ |
| 26 | +public class ThoaiSelectionSortTest { |
| 27 | + SelectionSort selectionSort = new SelectionSort(); |
| 28 | + @Test |
| 29 | + public void tesInsertIntoSorted() { |
| 30 | + int[] inputArr = new int[] {1,3,5}; |
| 31 | + int[] inputResult = new int[] {1,3,5}; |
| 32 | + selectionSort.selectionSort(inputArr); |
| 33 | + assertArrayEquals(inputResult, inputArr); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void tesInsertIntoSorted2() { |
| 38 | + int[] inputArr = new int[] {5,3,1}; |
| 39 | + int[] inputResult = new int[] {1,3,5}; |
| 40 | + selectionSort.selectionSort(inputArr); |
| 41 | + assertArrayEquals(inputResult, inputArr); |
| 42 | + } |
| 43 | + |
| 44 | + @Test |
| 45 | + public void tesInsertIntoSorted3() { |
| 46 | + int[] inputArr = new int[] {4,5,3,2}; |
| 47 | + int[] inputResult = new int[] {2,3,4,5}; |
| 48 | + selectionSort.selectionSort(inputArr); |
| 49 | + assertArrayEquals(inputResult, inputArr); |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments