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

Misnamed function in collections/hashmap2.rs? #688

Closed
dimitrijekostic opened this issue Mar 31, 2021 · 4 comments
Closed

Misnamed function in collections/hashmap2.rs? #688

dimitrijekostic opened this issue Mar 31, 2021 · 4 comments

Comments

@dimitrijekostic
Copy link

Hello, my impression is that the at_least_five_types_of_fruits() test function on lines 67-72 (in the testing module for collections/hashmap2.rs) has a misleading name, and would be more accurately named exactly_five_types_of_fruits(). Or perhaps the body of the function should be different?

@Zerotask
Copy link
Contributor

Zerotask commented Apr 23, 2021

Hello @dimitrijekostic
it seems that you mean collections/hashmap1.rs.
At least is correct here since the body's assertion is >= 5. This means it results in a true if you have 5 or 10 or 500 fruits, everything which is 5 or greater.

@dimitrijekostic
Copy link
Author

@Zerotask No, I'm referring to collections/hashmap2.rs. The hashmap exercises have similarly-named methods in them:
collections/hashmap1.rs has at_least_five_fruits()
collections/hashmap2.rs has at_least_five_types_of_fruits()
I'm referring to the latter. Note that at_least_five_types_of_fruits() contains an assert!(count_fruit_kinds == 5); which is not what the name of the method leads you to expect.

@Zerotask
Copy link
Contributor

Zerotask commented May 4, 2021

Oh, it seems I was a bit blind. :D You're right.

This is already fixed with #660

assert!(count_fruit_kinds >= 5);

@dimitrijekostic
Copy link
Author

Very good, I guess I just need to do another pull. Thanks for looking into it!

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

No branches or pull requests

2 participants