Skip to content

[WIP] nth-prime: Add test file generator.#411

Merged
Insti merged 1 commit intoexercism:masterfrom
clettenberg:nth-prime-bookkeeping
Oct 5, 2016
Merged

[WIP] nth-prime: Add test file generator.#411
Insti merged 1 commit intoexercism:masterfrom
clettenberg:nth-prime-bookkeeping

Conversation

@clettenberg
Copy link
Copy Markdown
Contributor

The Nth Prime problem was missing BookKeeping module.

@kotp
Copy link
Copy Markdown
Member

kotp commented Aug 1, 2016

It is OK, because this exercise is not yet generated, and so does not need the BookKeeping information yet.

Would you be up to writing the generator while you are here and interested?

@clettenberg
Copy link
Copy Markdown
Contributor Author

Sure 👍

@Insti Insti changed the title Add BookKeeping module to Nth Prime [WIP] nth-prime: Add test file generator. Aug 3, 2016
@clettenberg clettenberg force-pushed the nth-prime-bookkeeping branch 2 times, most recently from f99d227 to 29e7f58 Compare August 11, 2016 02:35
@clettenberg clettenberg force-pushed the nth-prime-bookkeeping branch 2 times, most recently from 21c627c to 2ebb7af Compare August 11, 2016 02:48
@clettenberg
Copy link
Copy Markdown
Contributor Author

@kotp Just pushed up code for the generator.

I also created a PR on x-common with the test case json.

Let me know if I've missed something!

Comment thread exercises/nth-prime/nth_prime_test.rb Outdated

def test_bookkeeping
skip
assert_equal 2, BookKeeping::VERSION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be version 1.

@kotp
Copy link
Copy Markdown
Member

kotp commented Aug 11, 2016

First look, this looks pretty good. Version number needs to be set back to 1.

Comment thread lib/nth_prime_cases.rb Outdated
'test_%s' % description.downcase.gsub(/[ -]/, '_')
end

def do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really don't like that there is a method called do,
I see it a lot, is there documentation that uses an example with do in it?

I'd prefer it be called actual to fit the assert_equal expected, actual pattern but am open to other suggestions for better names.

Copy link
Copy Markdown
Member

@kotp kotp Aug 11, 2016

Choose a reason for hiding this comment

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

This is true, it mirrors a keyword in Ruby, so is not a good feeling.

Let's avoid it if we can.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There's no documentation on do. I had seen it in a few other files when I was working on this.

I'll change it to actual.

@clettenberg clettenberg force-pushed the nth-prime-bookkeeping branch 2 times, most recently from 0887fe5 to 85d5686 Compare August 12, 2016 02:06
@clettenberg
Copy link
Copy Markdown
Contributor Author

I rolled back the version and updated it to reflect the changes to the x-common PR

def <%= test_case.name %><% if test_case.skipped? %>
skip<% end %>
assert_equal <%= test_case.expected %>, <%= test_case.actual %>
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be good to remove the conditional from the template.
See how https://github.com/exercism/xruby/blob/master/lib/rna_transcription_cases.rb handles this.

@Insti
Copy link
Copy Markdown
Contributor

Insti commented Aug 12, 2016

Waiting on exercism/problem-specifications#332 which needs to be merged first.

def test_big_prime
skip
assert_equal 104_743, Prime.nth(10_001)
assert_equal 104743, Prime.nth(10001)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you wanted to be nice, you could make a helper method that formatted the numbers from the json into underscored versions in the test file.

(This is not at all a requirement, just an optional extra if you feel like it.)

@clettenberg clettenberg force-pushed the nth-prime-bookkeeping branch from 85d5686 to 9b1b74b Compare August 14, 2016 12:59
@Cohen-Carlisle
Copy link
Copy Markdown
Member

This looks ready to merge to me. 👍

@Insti
Copy link
Copy Markdown
Contributor

Insti commented Aug 22, 2016

Still waiting on exercism/problem-specifications#332. Perhaps you could prod that along.

@Cohen-Carlisle
Copy link
Copy Markdown
Member

The x-common PR has been merged. Is this PR in sync with the master branch of x-common and ready to be merged?

@clettenberg clettenberg force-pushed the nth-prime-bookkeeping branch from 9b1b74b to cc9d7e8 Compare October 5, 2016 01:48
@clettenberg
Copy link
Copy Markdown
Contributor Author

@Cohen-Carlisle Sorry for the late reply. I think this PR is good to go with the recent update to the data method in generator.rb

@Insti Insti merged commit 72b3a90 into exercism:master Oct 5, 2016
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Oct 5, 2016

Thanks a lot @cacqw7 ❤️

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