Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forth: evaluateBoth property #2018

Open
NobbZ opened this issue Apr 20, 2022 · 5 comments
Open

forth: evaluateBoth property #2018

NobbZ opened this issue Apr 20, 2022 · 5 comments

Comments

@NobbZ
Copy link
Member

NobbZ commented Apr 20, 2022

In the forth specification there is a single test for the evaluateBoth property.

The remaining tests are for the evaluate property.

https://github.com/exercism/problem-specifications/blob/main/exercises/forth/canonical-data.json#L510

This confused the erlang test generator recently, as it assumes the property key points to the function under test.

Is this a missunderstanding on my side or do we need to find another way to specify a sequence of operations/function calls in the spec?

@glennj
Copy link
Contributor

glennj commented May 5, 2022

Nobody's commented on this so far: my take:

The README describes it like

   " The 'property' is a string in lowerCamelCase identifying ",
   " the type of test, but most of the times it is just the   ",
   " name of a function being tested.                         ",

I don't see it documented anywhere else as meaning anything more specific.

Clearly, it can't be absolutely relied upon to be anything more than a label describing some action to impose upon the system under test.

For forth specifically, the point is to instantiate two forth evaluators and ensure that inputs to one do not bleed into the other -- that can't be a single function on a single instance. (The bash track excludes this test: clearly two separate scripts running in different processes cannot accidentally interact).

Sadly, the generator will need some specific instructions for some exercises.

@ErikSchierboom
Copy link
Member

I don't see it documented anywhere else as meaning anything more specific.

Clearly, it can't be absolutely relied upon to be anything more than a label describing some action to impose upon the system under test.

This is true. In 99% of the test cases, the property can be used as the function name, but there are test cases where this can't work, either because the thing that is being tested is impossible to map to a JSON object with inputs/outputs (e.g. something being random, see https://github.com/exercism/problem-specifications/blob/main/exercises/diffie-hellman/canonical-data.json#L33), or because it is describing multiple actions (like the forth test case you mentioned).

Sadly, the generator will need some specific instructions for some exercises.

It should indeed. I wonder if it would be a good idea to add a scenario for these exceptional test cases, which could then be detected by a generator.

@kytrinyx
Copy link
Member

I think a scenario is a very good suggestion.
How about local-scope? We already have that scenario, and it seems to fit the bill.

@ErikSchierboom
Copy link
Member

ErikSchierboom commented Nov 11, 2022

How about local-scope? We already have that scenario, and it seems to fit the bill.

Yes, that does indeed fit the bill well and should indeed be added!

What I was originally suggesting was to add another scenario, namely one that indicates that the property is different from a regular property and requires special treatment by a test generator. But maybe we don't need it as certain scopes will always require this special treatment, like local-scope and immutable. Maybe it is enough to identify all test cases that have special behavior and a add an appropriate scenario?

Here is another weird test case in dnd-character:

{
  "uuid": "2ca77b9b-c099-46c3-a02c-0d0f68ffa0fe",
  "description": "each ability is only calculated once",
  "property": "strength",
  "input": {},
  "expected": "strength == strength"
}

Should this have a memoized or memoization scenario?

@kytrinyx
Copy link
Member

Ah, yeah, memoization is probably a good idea there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants