Skip to content

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

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 1 commit into from
Oct 5, 2016

Conversation

clettenberg
Copy link
Contributor

The Nth Prime problem was missing BookKeeping module.

@kotp
Copy link
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
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
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!


def test_bookkeeping
skip
assert_equal 2, BookKeeping::VERSION
Copy link
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
Member

kotp commented Aug 11, 2016

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

'test_%s' % description.downcase.gsub(/[ -]/, '_')
end

def do
Copy link
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
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
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
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
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
Contributor

Insti commented Aug 12, 2016

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

@@ -22,13 +25,35 @@ def test_sixth_prime

def test_big_prime
skip
assert_equal 104_743, Prime.nth(10_001)
assert_equal 104743, Prime.nth(10001)
Copy link
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
Member

This looks ready to merge to me. 👍

@Insti
Copy link
Contributor

Insti commented Aug 22, 2016

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

@Cohen-Carlisle
Copy link
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
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
Contributor

Insti commented Oct 5, 2016

Thanks a lot @cacqw7 ❤️

gchan pushed a commit to gchan/xruby that referenced this pull request Oct 18, 2016
A consonant+qu should be moved to the end of the word, but not a vowel+qu. I've added a test case for this, as I've seen multiple solutions where this rule wasn't followed exactly.
@Insti Insti removed the in progress label May 19, 2017
@Insti Insti removed the ready label Jun 8, 2017
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