Skip to content

Multiple-answer problems need assert!(matches!(expr, pat | pat) #6

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

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

workingjubilee
Copy link
Contributor

I rewrote some test code here to use patterns in the asserts so that it is correct even if the sort ordering generated by sort_unstable_by changes.

@workingjubilee
Copy link
Contributor Author

Without this your code fails on the nightly version because it depends on unspecified implementation details of the standard library which are deliberately subject to change without notice, because we would like to continue improving its internals.

failures:

---- sort_characters_by_frequency::tests::test stdout ----
thread 'sort_characters_by_frequency::tests::test' panicked at leetcode/src/00451_sort_characters_by_frequency/solution.rs:27:9:
assertion `left == right` failed
  left: "eetr"
 right: "eert"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    sort_characters_by_frequency::tests::test

test result: FAILED. 396 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

@lht102
Copy link
Owner

lht102 commented Mar 19, 2025

I missed the PR and just get back to this repo recently. sorry for the late reply.
thanks for that!

I found this is amazing that rust team had built something to find regression after updating the sort implementation. this is very cool.

@lht102 lht102 merged commit b7811fb into lht102:master Mar 19, 2025
@workingjubilee workingjubilee deleted the multiple-choice-answers branch March 20, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants