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

Tournament - add non-error test case with a different team name

Open norbs57 opened this issue 3 years ago • 3 comments

For the tournament exercise, one of my students took the team names from the instructions and hard-coded them in the source code. Despite this, his solution passed all the tests. I believe this is because in all of the "non-error" test cases, the team names are the same as in the instructions. To discourage this hard-coding of team names, I would suggest to either

  1. add a non-error test case with different team names, or
  2. to change (at least) one of the team names in one of the existing non-error test cases.

norbs57 avatar Mar 17 '22 20:03 norbs57

Changing test cases is not allowed according to the spec, so (2) is not an option here.

Perhaps you could open a PR that adds such a case?


As a side note in case you're newish to Exercism: the tests on Exercism generally assume that the student is actually willing to learn and doesn't try to "cheat" the exercises, that's why a lot of exercises don't check for completeness and don't have guards against hardcoding solutions. You will encounter the same issue in many exercises.

SaschaMann avatar Mar 17 '22 21:03 SaschaMann

I will open a PR.

Thanks for the side note - I understand. I guess it still makes sense to have test cases that reduce the chance that certain poor coding practices happen. But maybe "hardcoding test data" is something the automatic code analysers could catch (sometime in the future)?

norbs57 avatar Mar 17 '22 22:03 norbs57

I guess it still makes sense to have test cases that reduce the chance that certain poor coding practices happen.

Yea, I agree

SaschaMann avatar Mar 17 '22 22:03 SaschaMann