From 84b26ef146a03132f40d949bbb430dac854ae1e3 Mon Sep 17 00:00:00 2001 From: NguyenKhanhIE3 Date: Fri, 27 Sep 2019 14:55:08 +0700 Subject: [PATCH] =?UTF-8?q?T=E1=BA=A1o=20ca=20ki=E1=BB=83m=20th=E1=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Introduction/TestQuicksort.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 java/Chapter 11/Introduction/TestQuicksort.java diff --git a/java/Chapter 11/Introduction/TestQuicksort.java b/java/Chapter 11/Introduction/TestQuicksort.java new file mode 100644 index 00000000..b1aa5fca --- /dev/null +++ b/java/Chapter 11/Introduction/TestQuicksort.java @@ -0,0 +1,56 @@ +package Introduction; + +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.Assert.assertArrayEquals; +import org.junit.jupiter.api.Test; + + +class TestQuicksort { + + @Test + void test1() { + Quicksort quicksort1 = new Quicksort(); + int[] arr1 = {0,9,8,1}; + assertArrayEquals({0,1,8,9},quicksort1.quickSort(arr1, 0, 3)); + + + } + + @Test + void test2() { + Quicksort quicksort2 = new Quicksort(); + int[] arr2 = {3,0,7,-2,1}; + assertArrayEquals({-2,0,1,3,7},quicksort2.quickSort(arr2, 0, 4)); + + + } + + @Test + void test3() { + Quicksort quicksort3 = new Quicksort(); + int[] arr3 = {-6,2,0}; + assertArrayEquals({-6,0,2},quicksort3.quickSort(arr3, 0, 2)); + + + } + + @Test + void test4() { + Quicksort quicksort4 = new Quicksort(); + int[] arr4 = {-4,-5,0,7,1,-8}; + assertArrayEquals({-8,-5,-4,0,1,7},quicksort4.quickSort(arr4, 0, 5)); + + + } + + @Test + void test5() { + Quicksort quicksort5 = new Quicksort(); + int[] arr5 = {-8,-3,2,0}; + assertArrayEquals({-8,-3,0,2},quicksort5.quickSort(arr5, 0, 3)); + + + } + + +}