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
exercises(resistor-color-duo): should not silently ignore additional colors #202
Comments
Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed. That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there. Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it. |
Thanks. I'm gradually getting around to cleaning up things like this. I agree that the current implementation isn't great. I'm leaning towards removing that test case, and changing the function signature from
to pub fn colorCode(colors: [2]ColorBand) isize { given that we probably have enough exercises to practice error sets and input validation. What do you think? |
Yes, that's actually even better! |
https://github.com/exercism/zig/blob/main/exercises/practice/resistor-color-duo/test_resistor_color_duo.zig#L42-L47
This test expects the code to silently ignore any additional values in the input array.
This pretty much goes against the Zig way of doing things, the hidden assumption can lead to bugs.
The function should return an error instead of silently continuing when the passed in slice is longer than 2 elements.
The text was updated successfully, but these errors were encountered: