Skip to content

high-scores: incorrect parameter or description of parameter #223

Description

@siebenschlaefer

In the exercise "high-scores" the three functions under test receive an offset and a length.
IMHO the name and description of the "length" imply that this parameter contains the number of elements.
But it actually contains the length of the array in bytes.


Concrete:

In the initial stub the parameter is named $inputElements with the explanation "number of u32 elements in the input".
https://github.com/exercism/wasm/blob/main/exercises/practice/high-scores/high-scores.wat#L8
The tests multiply the length of the array with u32Size to get the number of bytes and pass that "encodedLength" to the function under test
https://github.com/exercism/wasm/blob/main/exercises/practice/high-scores/high-scores.spec.js#L27-L39

In contrast:
In the exercise "binary-search" the tests pass the haystack.length (the number of elements) to the function under test.
https://github.com/exercism/wasm/blob/main/exercises/practice/binary-search/binary-search.spec.js#L37
And the initial stub correctly describes the parameter as "@PARAM {i32} nelems - the number of elements in the haystack"
https://github.com/exercism/wasm/blob/main/exercises/practice/binary-search/binary-search.wat#L8


I think this is inconsistent and misleading.
IMHO the tests should pass the number of elements to the function under test.

Activity

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