-
Notifications
You must be signed in to change notification settings - Fork 520
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
Check that result contains expected allergens #134
Conversation
Fixes #130 Testing for all allergies would fail if the allergens weren't in the same order as the test vector. This checks that the result contains all the expected allergens rather than expecting the result and test vector to be equal.
Good change! I would add one more test: that |
Are we missing this test in https://github.com/exercism/x-common/blob/master/allergies.json? |
Oh wait, do you mean check that |
Same test or different test, I don't think I have a strong opinion. I'm happy to merge this as-is. @kytrinyx, I think the tests in the json file are fine. This is just a way to make the canonical tests work for Rust, while still handling the weird edge case that could emerge because of our testing approach. |
Great! I'll leave it alone then. No need to over-complicate things. |
Fireworks. Marching Bands. Etc. Thank you! |
Fixes exercism#135 - Introducing tests that were missing - Handling the ordering problem in all tests that check vectors, encapsulating the solution introduced in exercism#134 - Updating test names to not start with `test_` - Cargo starts each test result line with "test ", followed by the test's name.. So these tests looked like "test test_allergic_to_peanuts". - Trying to give the final test a useful name. "ignore non allergen score parts" didn't make much sense to me when I worked on this exercise. I think the new name better describes what we're trying to capture.
Fixes exercism#135 - Introducing tests that were missing - Handling the ordering problem in all tests that check vectors, encapsulating the solution introduced in exercism#134 - Updating test names to not start with `test_` - Cargo starts each test result line with "test ", followed by the test's name.. So these tests looked like "test test_allergic_to_peanuts". - Trying to give the final test a useful name. "ignore non allergen score parts" didn't make much sense to me when I worked on this exercise. I think the new name better describes what we're trying to capture.
* Update tests to canonical set Fixes #135 - Introducing tests that were missing - Handling the ordering problem in all tests that check vectors, encapsulating the solution introduced in #134 - Updating test names to not start with `test_` - Cargo starts each test result line with "test ", followed by the test's name.. So these tests looked like "test test_allergic_to_peanuts". - Trying to give the final test a useful name. "ignore non allergen score parts" didn't make much sense to me when I worked on this exercise. I think the new name better describes what we're trying to capture. Testing iterator equality seems like a nicer way of comparing these two vectors. And I'm now returning a useful error message when the vectors are not equal. If you do ```rust assert_eq!(expected.iter().eq(actual.iter())) ``` The error message is just that the two iterators are not equal. The differing elements are not called out in any way. Not as helpful.
Fixes #130
Testing for all allergies would fail if the allergens weren't in the
same order as the test vector.
This checks that the result contains all the expected allergens rather
than expecting the result and test vector to be equal.