-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
SortUtils.h is missing tests #32420
Comments
tcarmelveilleux
added a commit
to tcarmelveilleux/connectedhomeip
that referenced
this issue
Mar 4, 2024
- SortUtils.h has no tests. While it is apparently trivial, we should never have code that has no tests - BubbleSort could crash (never-ending loop due to integer overflow) when input size was < 2. Its use is removed and replaced by InsertionSort which is known to be faster on average. A better solution is to move to using STL sorts in the future, but this requires analysis of flash costs and STL usage, given lambdas are used with sorts many places. Fixes project-chip#32420 Testing done: - Added missing unit tests. - All integration tests still pass.
andy31415
added a commit
that referenced
this issue
Mar 5, 2024
* Add tests to lib/support/SortUtils.h - SortUtils.h has no tests. While it is apparently trivial, we should never have code that has no tests - BubbleSort could crash (never-ending loop due to integer overflow) when input size was < 2. Its use is removed and replaced by InsertionSort which is known to be faster on average. A better solution is to move to using STL sorts in the future, but this requires analysis of flash costs and STL usage, given lambdas are used with sorts many places. Fixes #32420 Testing done: - Added missing unit tests. - All integration tests still pass. * Restyled by clang-format * Fix build error on Android * Add constness to operator== --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
erwinpan1
pushed a commit
to erwinpan1/connectedhomeip
that referenced
this issue
Mar 7, 2024
* Add tests to lib/support/SortUtils.h - SortUtils.h has no tests. While it is apparently trivial, we should never have code that has no tests - BubbleSort could crash (never-ending loop due to integer overflow) when input size was < 2. Its use is removed and replaced by InsertionSort which is known to be faster on average. A better solution is to move to using STL sorts in the future, but this requires analysis of flash costs and STL usage, given lambdas are used with sorts many places. Fixes project-chip#32420 Testing done: - Added missing unit tests. - All integration tests still pass. * Restyled by clang-format * Fix build error on Android * Add constness to operator== --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
huangxuyong
pushed a commit
to huangxuyong/connectedhomeip
that referenced
this issue
Mar 19, 2024
* Add tests to lib/support/SortUtils.h - SortUtils.h has no tests. While it is apparently trivial, we should never have code that has no tests - BubbleSort could crash (never-ending loop due to integer overflow) when input size was < 2. Its use is removed and replaced by InsertionSort which is known to be faster on average. A better solution is to move to using STL sorts in the future, but this requires analysis of flash costs and STL usage, given lambdas are used with sorts many places. Fixes project-chip#32420 Testing done: - Added missing unit tests. - All integration tests still pass. * Restyled by clang-format * Fix build error on Android * Add constness to operator== --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SortUtils.h is used by DNS-SD, session eviction and Network Commissioning. The sorts claim to be stable, but there are zero unit tests.
The SortUtils.h methods should be unit-tested.
The text was updated successfully, but these errors were encountered: