Skip to content

Conversation

AlexLB99
Copy link

Towards solving #19

These are harnesses for functions make_ascii_uppercase() and make_ascii_lowercase(). They check that only the correct letters are modified (and that those that do need to be modified become the correct uppercase/lowercase character).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@AlexLB99 AlexLB99 requested a review from a team as a code owner May 27, 2025 21:36
Comment on lines +3089 to +3096

for (i, &item) in s.as_bytes().iter().enumerate() {
if item >= b'a' && item <= b'z' {
assert_eq!(s_uppercase[i], item - 32);
} else {
assert_eq!(s_uppercase[i], item);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be expressed as a post-condition (ensures) on make_ascii_uppercase?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexLB99 Kani supports Quantifiers now: https://model-checking.github.io/kani/reference/experimental/quantifiers.html. I strongly suggest trying this feature for the case.

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.

3 participants