New tests for Forth exercise canonical data

I’m mentoring a student who is pushing new words onto the end of the list, but for arithmetic is shifting numbers from the head of the list. This error is not exposed because the tests only ever do addition when there are only 2 numbers on the stack.

I propose 2 new tests:

    {
      "description": "combined arithmetic",
      "cases": [
        ...,
        {
          "uuid": "...",
          "description": "multiplication and addition",
          "property": "evaluate",
          "input": {
            "instructions": ["1 2 3 * +"]
          },
          "expected": [7]
        },
        {
          "uuid": "...",
          "description": "addition and multiplication",
          "property": "evaluate",
          "input": {
            "instructions": ["1 2 3 + *"]
          },
          "expected": [5]
        }
      ]
1 Like

This reminds me that there is no https://forum.exercism.org/c/programming/forth/ category.


I had noticed the same thing, but had treated the additional (no pun intended) operands to be an extension to the exercise.

Fixed! Thanks for the heads-up.