Skip to content

pov 1.1.0: Make exercise schema-compliant #704

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

Merged
merged 4 commits into from
Mar 11, 2017
Merged

pov 1.1.0: Make exercise schema-compliant #704

merged 4 commits into from
Mar 11, 2017

Conversation

petertseng
Copy link
Member

@petertseng petertseng commented Mar 11, 2017

You probably want to review commit-by-commit (but hey don't let me tell you what to do, if you want to review the whole thing at once you are free to do it!).

I suppose there can still be a reformatting too (you'll notice a "cases": [{) line but...

  1. Since testGroup is necessarily and both types that might be elements of it are objects, I have absolutely no compunction about putting the [{ on the same line!
    • Unfortunately, I did not apply the same treatment to the inner cases, sorry.
  2. Keeping that diff small!
  3. Okay, if you really want me to reformat, I can, but I wanted to make sure that there are no other changes that people want, because then I would have to rebase and blow away my reformatting.

As part of the work in #625

@petertseng
Copy link
Member Author

petertseng commented Mar 11, 2017

I find the commit message of "replace unnecessary uses of cousin with smaller tree" lacking. I am going to amend its commit message. The contents will not otherwise change, so feel free to continue your review unimpeded.

That is better. By the way, you could maybe convince me to make some of those "cousins" replacements smaller. As I explained in the commit message, it's not really interesting to have a large tree for an error case.

At this point, if only the `trees` key were to be deleted, this file
would conform to the schema as desired by #625.

We will need to delete the `trees` key using the plan set out in #699.
In #699 we discussed that referring to trees by name rather than
embedding has a few costs:

* Requires schema change.
* `shared` or `resources` section must be exercise-dependent by nature.
* More complex test generators.
* Harder for a human to understand the test (must refer back and forth
  between the individual case and the "trees" listing).

We have decided this is not worth it.

Extra work on the `cousins` tree is required to reduce its usage, so it
will not yet be embedded.
We would like to reduce the tree so that:

1. It's clearer what is being tested
2. The duplication in the test file is kept to fewer lines

This helps us be rid of the top-level `"trees"` key as desired in #699.

The usages of "cousin" that were replaced:

**Three error cases**:

1. "Errors if target does not exist in a large tree"
2. "Errors if destination does not exist"
3. "Errors if source does not exist"

In all three cases, a "large" tree is all that is necessary. It doesn't
necessarily have to be the entire "cousin" tree.

Besides, it's not very interesting to see whether a student can *fail*
to find a nonexistent node in a large tree, because the student can just
as easily achieve it by not doing any searching at all. It's much more
intersting to see whether the student can find an existent node in a
large tree. So these error cases really don't need a very large tree.

A "large" tree is all that is needed, but it doesn't necessarily have to
so big so as to be the entire "cousin" tree.

**One case of "Can find path from nodes other than x"**:

Nothing in this case requires the use of the specific "cousins" tree.

Since the test contents have now changed, this is now version 1.1.0.
This concludes the `pov` portion of #699.
This finally brings the `pov` exercise's JSON file in compliance with
the schema, concluding the relevant portion of #625.
@petertseng
Copy link
Member Author

I've been suggested to bump this to 1.1.0

By the way, I prefer this NOT be squashed on merge.

@petertseng
Copy link
Member Author

Q: You changed the test inputs. How do we know the new outputs match the new inputs? The schema check only checks for conformance to the schema, and not the actual correctness of the test data.

A: I did it before, and I'll do it again.

Build Status

https://github.com/petertseng/x-common/blob/verify/exercises/pov/verify.rb

Copy link
Contributor

@rbasso rbasso left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @petertseng! 👍

@petertseng petertseng merged commit 850ae97 into exercism:master Mar 11, 2017
@petertseng petertseng deleted the pov branch March 11, 2017 12:17
petertseng added a commit that referenced this pull request Mar 12, 2017
We had already removed these in #704, but I forgot to remove the
comments.
@petertseng petertseng changed the title pov: Make exercise schema-compliant pov 1.1.0: Make exercise schema-compliant Mar 12, 2017
petertseng added a commit to exercism/haskell that referenced this pull request May 9, 2017
This was the main change in exercism/problem-specifications#704

exercism/problem-specifications#710 is an inconsequential
change that does not affect our tests.

Two other changes in 1.1.0 that aren't exactly followed:

* As a part of conforming to the canonical schema, trees were embedded
  into the test data, but we have no need to do it - let's reduce
  duplication, and besides we are safe from accidental mutation.
* The "cannot trace" cases were changed to use simpler trees than
  cousins, but we would have had to introduce another tree to do that
  (one with kids and siblings). We'll stick with cousins.
emcoding pushed a commit that referenced this pull request Nov 19, 2018
config.json: Add blurb, fix Gitter name
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