Skip to content

two-bucket: test inability to reach the goal#870

Merged
petertseng merged 2 commits intoexercism:masterfrom
petertseng:bucket-impossible
Sep 10, 2019
Merged

two-bucket: test inability to reach the goal#870
petertseng merged 2 commits intoexercism:masterfrom
petertseng:bucket-impossible

Conversation

@petertseng
Copy link
Copy Markdown
Member

The student solution would need to employ one of several strategies:

  • (If searching the state space) Notice that there are no further states
    to be visited, and yet the solution has not been reached.
  • Notice that the goal is not divisible by the GCD of the bucket sizes,
    therefore can be rejected immediately.

In case the student assumes that all non-coprime bucket counts will
invalidate the goal, a counterexample to that is given as well (buckets
not coprime but goal is still possible).

There are ten implementing tracks:
bash csharp fsharp go java javascript python ruby rust typescript

Of these tracks, only two of them (Bash, Go) currently test the
condition where it is not possible to reach the goal.

Having this test serves as a reminder that it remains wise to handle the
situation where a search has not found its goal.

exercism/problem-specifications#1580


Completely indifferent as to whether commits are squashed. In the case of no opinions, I will choose not to.

Preparing for cases where reaching the goal is impossible.
The student solution would need to employ one of several strategies:

* (If searching the state space) Notice that there are no further states
  to be visited, and yet the solution has not been reached.
* Notice that the goal is not divisible by the GCD of the bucket sizes,
  therefore can be rejected immediately.

In case the student assumes that all non-coprime bucket counts will
invalidate the goal, a counterexample to that is given as well (buckets
not coprime but goal is still possible).

There are ten implementing tracks:
bash csharp fsharp go java javascript python ruby rust typescript

Of these tracks, only two of them (Bash, Go) currently test the
condition where it is not possible to reach the goal.

Having this test serves as a reminder that it remains wise to handle the
situation where a search has not found its goal.

exercism/problem-specifications#1580
Copy link
Copy Markdown
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I haven't done a line-by-line code review of anything except tests/two-bucket.rs. If CI passes, then all tests pass, which means that src/lib.rs and example.rs have both been appropriately modified.

That said, this looks like a good change to me.

@petertseng petertseng merged commit 4bf068d into exercism:master Sep 10, 2019
@petertseng petertseng deleted the bucket-impossible branch September 10, 2019 02:50
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

Successfully merging this pull request may close these issues.

2 participants