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

pov: Add canonical data #390

Merged
merged 1 commit into from
Oct 7, 2016
Merged

pov: Add canonical data #390

merged 1 commit into from
Oct 7, 2016

Conversation

petertseng
Copy link
Member

Existing implementations:

The tests are a combination of the existing tests.

The trees used:

  • Singleton (present in all)
  • Simple tree: X, parent, sibling (present in Clojure, Go, Lua)
  • Large flat tree: X, parent, three siblings (present in all)
  • Deeply nested tree: "singly-linked list" as a tree (present in all)
  • Target has children: X, parent, two children (present in all*)
    (in Clojure, Go, Lua, this case is embedded in a more complex tree)
  • Target has cousins (present in all)

All tracks tested looking for the node named "x" in these trees, then
looking for a nonexistent node.

The Lua track had a gentler progression of complexity in the path tests,
so that was used. This is necessary simply because even after the reroot
is done, there is still work to be done to search for the target node.

(The Go track chose not to test paths)

Closes https://github.com/exercism/todo/issues/128

"description": [
"Reroot a tree so that its root is the specified node.",
"In this way, the tree is presented from the point of view of the specified node.",
"The input trees used here are those in the `trees` section of this file.",
Copy link
Member Author

Choose a reason for hiding this comment

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

I chose to the put the input trees in the "trees" section because they are used more than once and it seemed useful to allow people to easily see that they are the same six trees being reused.

In contrast, I put the expected output trees inline since they are only used once.

"If appropriate for your track, you may test that the input tree is not modified.",
"",
"Note that when rerooting upon a target node that has both parents and children,",
"it does not matter whether the former parent comes before or after the former children.",
Copy link
Member Author

Choose a reason for hiding this comment

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

@petertseng
Copy link
Member Author

A lot of this was done by hand, so it behooves me to automatically verify its correctness. I have not the strength for that now, so that will have to come later.

@petertseng
Copy link
Member Author

This has been verified for correctness, by https://github.com/petertseng/x-common/blob/verify/exercises/pov/verify.rb

@kytrinyx
Copy link
Member

kytrinyx commented Oct 2, 2016

/cc @exercism/clojure @exercism/golang @exercism/haskell @exercism/fsharp @exercism/lua You all have an implementation of this. If you have an opinion about this, speak up.

],
"cases": [
{
"tree": "singleton",
Copy link
Member Author

Choose a reason for hiding this comment

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

potentially contentious point: No "description": for any of these. I think I would rather have descriptions.

Copy link
Member

Choose a reason for hiding this comment

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

Right—in the simpler exercise a lot of the descriptions became silly, just echoing the inputs and outputs. Here it probably makes more sense to flesh out the purpose of the test in a description.

@ErikSchierboom
Copy link
Member

I love the usage of uncle, kid, and such. It greatly helps intuit what's happening.

@ryanplusplus
Copy link
Member

I'm fairly certain that I actually stole all of the Lua tests from the Ruby track and I was pretty happy with those... so this looks good to me :)

Existing implementations:

* https://github.com/exercism/xclojure/blob/master/exercises/pov/test/pov_test.clj
* https://github.com/exercism/xfsharp/blob/master/exercises/pov/PovTest.fs
* https://github.com/exercism/xgo/blob/master/exercises/pov/pov_test.go
* https://github.com/exercism/xhaskell/blob/master/exercises/pov/test/Tests.hs
* https://github.com/exercism/xlua/blob/master/exercises/pov/pov_spec.lua

The tests are a combination of the existing tests.

The trees used:

* Singleton (present in all)
* Simple tree: X, parent, sibling (present in Clojure, Go, Lua)
* Large flat tree: X, parent, three siblings (present in all)
* Deeply nested tree: "singly-linked list" as a tree (present in all)
* Target has children: X, parent, two children (present in all*)
  (in Clojure, Go, Lua, this case is embedded in a more complex tree)
* Target has cousins (present in all)

All tracks tested looking for the node named "x" in these trees, then
looking for a nonexistent node.

The Lua track had a gentler progression of complexity in the path tests,
so that was used. This is necessary simply because even after the reroot
is done, there is still work to be done to search for the target node.

(The Go track chose not to test paths)

Closes https://github.com/exercism/todo/issues/128
@petertseng petertseng merged commit c407f30 into exercism:master Oct 7, 2016
@petertseng petertseng deleted the pov-json branch October 7, 2016 05:22
emcoding pushed a commit that referenced this pull request Nov 19, 2018
Change `students_by_grade` data structure. (+more) Closes #389
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.

4 participants