Skip to content

Hamming tests for empty input don't make sense #1761

@wolf99

Description

@wolf99

In the canonical-data.json for the hamming exercise there are three tests that appear to be in conflict with each other (or testing one things when intending to test separate things).

This question has impeded our update alignment of the C track's implementation of this exercise to match the current version of this problem specification (exercism/c#556) .

//...
    {
      "uuid": "919f8ef0-b767-4d1b-8516-6379d07fcb28",
      "description": "disallow first strand longer",
      "property": "distance",
      "input": {
        "strand1": "AATG",
        "strand2": "AAA"
      },
      "expected": {"error": "left and right strands must be of equal length"}
    },
    {
      "uuid": "8a2d4ed0-ead5-4fdd-924d-27c4cf56e60e",
      "description": "disallow second strand longer",
      "property": "distance",
      "input": {
        "strand1": "ATA",
        "strand2": "AGTG"
      },
      "expected": {"error": "left and right strands must be of equal length"}
    },
    {
      "uuid": "5dce058b-28d4-4ca7-aa64-adfe4e17784c",
      "description": "disallow left empty strand",
      "property": "distance",
      "input": {
        "strand1": "",
        "strand2": "G"
      },
      "expected": {"error": "left strand must not be empty"}
    },
    {
      "uuid": "38826d4b-16fb-4639-ac3e-ba027dec8b5f",
      "description": "disallow right empty strand",
      "property": "distance",
      "input": {
        "strand1": "G",
        "strand2": ""
      },
      "expected": {"error": "right strand must not be empty"}
    }

I read "empty strand" to mean a string of zero length, rather than a NULL or equivalent absence of any string at all (see #905 ).
However, given that input of both strands empty are allowed, this means that the latter two tests will fail due to unmatched string length even if empty string checking is not implemented. Thus I think that the latter tests will not test what is intended for them to test.

Can someone confirm my logic here?

I will suggest simply removing the latter two tests as a resolution, would this be acceptable?

PS: the following seems also related #1666

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