Exercise ResistorColor is confusing or too difficult

Hi,

For the C track I found the last test of this test very confusing.
It was very easy to map the mnemonics to an enum for the first 3 tests.

https:/exercism.org/tracks/c/exercises/resistor-color

But the last test has no signature for the colors() function. And the solution requires to return an array of values on the heap. (static array) I find these quite advanced topics for an easy assignment without any hints.

Which invites people to look up solutions.

It would actually have been easier for me to calculate the resistor value based on 4 random colors.

I agree with that suggestion Jelle. I’ve seen one mentoree enhancing the exercise with resistance units and resistance value computation (3 significant digits * multiplier) and I was very happily surprised!

My personal understanding of this exercise is that it makes people think about how enums work, and that our manually generated array has the same “value” as the test one. One may also notice that the enum values need to be in the proper 0-9 range, which is fine as BLACK is 0 by default. This knowledge/realisation is a bit hidden between the lines though. I’m not sure if there is some other background/objective in this exercise.

The original Issue seems to be picked up on Github. As you can see here.

But in my opinion this test could lie closer to an actual application. I would expect to use a function to determine the actual resistor value. By testing the actual bands of a resistor. If you add the multiplier colors, that wouldn’t be so hard. A test of:

const resistor_band_t resistor_bands = {YELLOW, VIOLET, GREEN,RED} 
TEST_ASSERT_EQUAL_UINT16(47500, colors(resistor_bands)); 

would make a lot more sense and lie closely to an actual application.