Skip to content

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

Open

Description

@norbs57

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.

Activity

  1. SaschaMann commented on Mar 17, 2022

    @SaschaMann
    Contributor

    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.

  2. norbs57 commented on Mar 17, 2022

    @norbs57
    ContributorAuthor

    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)?

  3. SaschaMann commented on Mar 17, 2022

    @SaschaMann
    Contributor

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

    Yea, I agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions