-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Conversation
"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.", |
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
This has been verified for correctness, by https://github.com/petertseng/x-common/blob/verify/exercises/pov/verify.rb |
/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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I love the usage of uncle, kid, and such. It greatly helps intuit what's happening. |
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
Change `students_by_grade` data structure. (+more) Closes #389
Existing implementations:
The tests are a combination of the existing tests.
The trees used:
(in Clojure, Go, Lua, this case is embedded in a more complex tree)
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