-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
prime-factors: add canonical data #513
prime-factors: add canonical data #513
Conversation
Again I have some issues with the test descriptions. Have a read through this comment: #451 (comment) |
@@ -0,0 +1,62 @@ | |||
{ | |||
"for": { | |||
"description": "returns prime factors for the given input number", |
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.
What are these 2 lines trying to achieve?
It's better to stick with the standard format. Have a look at some of the recent files added by @petertseng for good examples of what to do.
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.
The format that I was following (from other exercises) had the "method name" as the key for a block, then a description for what that method did, then the cases for that method call tests.
The examples I was following are here:
- https://github.com/exercism/x-common/tree/master/exercises/allergies/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/alphametics/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/atbash-cipher/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/binary/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/book-store/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/bowling/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/change/canonical-data.json
- https://github.com/exercism/x-common/tree/master/exercises/clock/canonical-data.json**
- https://github.com/exercism/x-common/tree/master/exercises/luhn/canonical-data.json
Somewhere in my travels through all different tickets and discussions around canonical data, I thought I read something that suggested a preference for the method name being included (not just the cases
key). So that's what that is for.
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.
Ok, Thanks. It's probably fine, further discussion here: #507 (review)
Agreed - the test descriptions are bad. And the note you pointed to was good. I'm still having trouble figuring out exactly how to write the tests without the data in them and that indicate what we're testing. In fact, if i go that route, then I think we have far more tests than we need. Thinking about it from scratch, I could imagine tests like
If this were the test suite, we'd could probably lose the test for 2, 9 and 27 and 625 and still have the coverage needed to show that the method works. Thoughts? |
Was trying to dismiss a request for changes.
This sounds much better, you're describing what you are testing without worrying about the specifics of the actual numbers used, and have identified some redundant tests that do not need to be among the cases. 👍 |
Although the descriptions could be made less verbose, so they can be more easily used as test names. 'no factors' There's a bit of a discussion about descriptions and test names happening here: #506 |
awesome. thanks for the tips.
i'll get an updated version in soon
…On Thu, Jan 26, 2017 at 1:24 AM, Geoff Hubbard ***@***.***> wrote:
Although the descriptions could be made less verbose, so they can be more
easily used as test names.
'no factors'
'prime number'
...
'product of primes'
There's a bit of a discussion about descriptions and test names happening
here: #506 <#506>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#513 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaFdEc1gdMUcnszyIIZCli7r8Ej2Zfkks5rWGZQgaJpZM4Ls3wf>
.
|
6afb3e0
to
6a9b757
Compare
I can squish this down to 1 commit if need be, since the first commit is almost meaningless given the re-write. |
{ | ||
"description" : "factors include a large prime", | ||
"input" : 93819012551, | ||
"expected" : [11, 9539, 894119] |
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.
caveat: I've not tried this problem myself recently.
Are these numbers (93819012551, 901255) within the bounds of reasonableness (<1sec) for today's computers without having to rely on Project Euler style optimisation trickery?
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 just completed this in elixir and ruby. it is interesting because a naive solution in ruby will take a very long time to complete. But there is an efficient solution that does not take too long (less than 1 sec i believe). I found it a good test to challenge the implementation.
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.
Ok. Great 😄 Thanks.
Squashing is good. |
Rewrite with shorter descriptions that speak to the functionality not the values in the tests - based on PR review discussions
73bda30
to
36faf10
Compare
squashed |
Thanks @bunnymatic ❤️ |
* prime-factors: add canonical data (exercism#513) * etl: Add canonical data (exercism#507) Add ETL exercise canonical data
Added canonical-data.json for the prime factors exercise exercise description here.
Addresses https://github.com/exercism/todo/issues/129