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]
}
]