Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add test in cycle_sort.cpp #1520

Merged
merged 11 commits into from
Jul 13, 2021
Prev Previous commit
Next Next commit
Update cycle_sort.cpp
  • Loading branch information
Swastyy committed Jul 6, 2021
commit 7726eba8552bd7989787077d0cd082ecdcac6f1d
4 changes: 2 additions & 2 deletions sorting/cycle_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ static void test() {
std::cout << "passed" << std::endl;

// [4.3, -6.5, -7.4, 0, 2.7, 1.8] return [-7.4, -6.5, 0, 1.8, 2.7, 4.3]
std::vector<int> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
std::vector<double> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
std::cout << "Test 2... ";
std::vector<int> arr2 = sorting::cycle_sort::cycleSort(array2);
std::vector<double> arr2 = sorting::cycle_sort::cycleSort(array2);
assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
std::cout << "passed" << std::endl;

Expand Down