Skip to content

Commit

Permalink
Update cycle_sort.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Swastyy committed Jul 10, 2021
1 parent 9509051 commit 92334d8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sorting/cycle_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ std::vector<T> cycleSort(const std::vector<T> &in_arr) {
static void test() {
// Test 1
// [4, 3, 2, 1] return [1, 2, 3, 4]
std::vector<int> array1 = {4, 3, 2, 1};
std::vector<uint32_t> array1 = {4, 3, 2, 1};
std::cout << "Test 1... ";
std::vector<int> arr1 = sorting::cycle_sort::cycleSort(array1);
std::vector<uint32_t> arr1 = sorting::cycle_sort::cycleSort(array1);
assert(std::is_sorted(std::begin(arr1), std::end(arr1)));
std::cout << "passed" << std::endl;

Expand All @@ -106,16 +106,16 @@ static void test() {

// Test 3
// [3, 3, 3, 3] return [3, 3, 3, 3]
std::vector<int> array3 = {3, 3, 3, 3};
std::vector<uint32_t> array3 = {3, 3, 3, 3};
std::cout << "Test 3... ";
std::vector<int> arr3 = sorting::cycle_sort::cycleSort(array3);
std::vector<uint32_t> arr3 = sorting::cycle_sort::cycleSort(array3);
assert(std::is_sorted(std::begin(arr3), std::end(arr3)));
std::cout << "passed" << std::endl;

// [9, 4, 6, 8, 14, 3] return [9, 4, 6, 8, 14, 3]
std::vector<int> array4 = {3, 4, 6, 8, 9, 14};
std::vector<uint32_t> array4 = {3, 4, 6, 8, 9, 14};
std::cout << "Test 4... ";
std::vector<int> arr4 = sorting::cycle_sort::cycleSort(array4);
std::vector<uint32_t> arr4 = sorting::cycle_sort::cycleSort(array4);
assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
std::cout << "passed" << std::endl;
}
Expand Down

0 comments on commit 92334d8

Please sign in to comment.