-
Notifications
You must be signed in to change notification settings - Fork 0
Test with BubleSort #16
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
base: master
Are you sure you want to change the base?
Conversation
| BubbleSort.Sort(listInt, new CompareIntInDescendingOrder()); | ||
| for (int i = 0; i < listInt.Count; ++i) | ||
| { | ||
| Assert.AreEqual(listInt[i], listCheck[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наоборот, первый параметр --- что ожидали, второй --- что получили
| { | ||
| Assert.AreEqual(listString[i], listCheck[i]); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тестов маловато. Стоило проверить на пустом списке, на списке, где все элементы одинаковы, на null-ы в параметрах. Задача-то простая очень, время было :)
| /// <param name="compare">компаратор</param> | ||
| public static void Sort<T>(List<T> list, Comparer<T> compare) | ||
| { | ||
| var lenght = list.Count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
length
| { | ||
| if (compare.Compare(list[j - 1], list[j]) >= 0) | ||
| { | ||
| //Swap(ref list[j], list[j + 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Закомментированный код не нужен
| /// <typeparam name="T">тип класса</typeparam> | ||
| /// <param name="list">лист значений</param> | ||
| /// <param name="compare">компаратор</param> | ||
| public static void Sort<T>(List<T> list, Comparer<T> compare) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше было принимать по интерфейсу, IComparer
| public override int Compare(int value1, int value2) | ||
| { | ||
| return value1 <= value2 ? 1 : -1 ; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут и в аналогичном месте ниже стоило использовать =>
No description provided.