problem-specifications icon indicating copy to clipboard operation
problem-specifications copied to clipboard

Unit tests for space_age exercise do not drive to a correct implementation

Open tronthomas opened this issue 5 years ago • 2 comments

The tests written for the space_age exercise appear to be insufficient and do not seem to drive someone toward creating a correct implementation.

Following the TDD principle of doing the simplest thing to make a test pass, for all the tests, someone can simply hard code the expected value and everything will pass.

tronthomas avatar Dec 12 '19 20:12 tronthomas

That’s true of more than just this exercise, there are several that could be “correctly” answered by just mapping each canonical input with its expected output.

Personally I feel that this is where the mentors come in; in a real world situation such a simplistic approach to TDD would simply get you fired, and rightfully so. If you submit such a solution to the mentor queue you’ll get a gentler form of pushback. If we diligently ensure that every solution cannot be solved we’re just encouraging people to believe that the tests describe correct functionality instead of minimal functionality, which is something TDD tests never do in the real world.

That said if you’d like to submit a PR with an extra test or two for each planet we could merge it after #1560 is resolved. You may find it difficult to design a set of tests for this exercise and the interface it describes that cannot be passed by a sufficiently large lookup table, though.

yawpitch avatar Dec 12 '19 21:12 yawpitch

@tronthomas Are you still interested on working on this issue?

That’s true of more than just this exercise, there are several that could be “correctly” answered by just mapping each canonical input with its expected output.

That's totally correct.

That said if you’d like to submit a PR with an extra test or two for each planet we could merge it after #1560 is resolved.

I think an extra test or two per planet could make sense.

ErikSchierboom avatar Jan 14 '22 14:01 ErikSchierboom