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

Implement exercise isbn-verifier #378

Merged
merged 1 commit into from
Nov 4, 2017

Conversation

ktomsic
Copy link
Contributor

@ktomsic ktomsic commented Oct 28, 2017

No description provided.

@coriolinus coriolinus self-requested a review October 28, 2017 22:39
@coriolinus
Copy link
Member

Hi @ktomsic! Thanks for this submission.

At first glance this looks good. I'm going to come back tomorrow to take a real look at it, but I don't anticipate any issues. Assuming I don't discover any, I'll approve this, wait a week for other people to chime in as desired, and then merge it.

Copy link
Member

@coriolinus coriolinus left a comment

Choose a reason for hiding this comment

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

Looks good to me! I'm going to wait in order to give other people the chance to chime in with their impressions, but unless someone discovers an issue I missed, I'll merge this on Friday.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

thanks for the work.

Readme is same as what's generated. ✔️
Tests match problem-specifications 1.0.0 ✔️

Okay, in that case the only thing I would change is the UUID.

config.json Outdated
@@ -178,6 +178,18 @@
]
},
{
"uuid": "53893984-080f-a180-5fa0-1af0fdb5ae3b6e23169",
Copy link
Member

Choose a reason for hiding this comment

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

the last portion is too long (should be 12 hexadecimal digits but has 19 by my count), so this is not a valid https://en.wikipedia.org/wiki/Universally_unique_identifier (I am assuming this is what a UUID is)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry. I generated this with configlet, but I hadn't seen that it might not generate valid UUIDs. This should be fixed now.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

So, I have a favour to ask.

I was dissatisfied with two test cases, and I made exercism/problem-specifications#993 and it got merged.

So, my favour to ask is can you update the test cases and version to match? I have labeled the places that I believe should change.

A separate commit or squashing are both acceptable.

I believe the example solution will already do the right thing for these inputs, so all that needs to be done is to update the tests.

#[ignore]
#[allow(non_snake_case)]
fn test_invalid_isbn_with_invalid_X() {
assert!(!is_valid_isbn("3-598-2X507-0"));
Copy link
Member

Choose a reason for hiding this comment

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

change the last digit 0 to a 9

#[test]
#[ignore]
fn test_invalid_isbn_too_long() {
assert!(!is_valid_isbn("3-598-21507-XA"));
Copy link
Member

Choose a reason for hiding this comment

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

change the A to an X

@@ -0,0 +1,4 @@
[root]
name = "isbn-verifier"
version = "1.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

-> 1.1.0

@@ -0,0 +1,3 @@
[package]
name = "isbn-verifier"
version = "1.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

-> 1.1.0

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

may optionally omit return + semicolon.

/// Checks if an 'X' is valid at the given position for the given ISBN type
#[allow(non_snake_case)]
fn is_X_valid(position: &usize, isbn_type: &IsbnType) -> bool {
return (isbn_type == &IsbnType::Isbn10 && position == &9 ) ||
Copy link
Member

Choose a reason for hiding this comment

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

optionally, you may omit the return here if you also omit the trailing semicolon. Up to you whether to do that.


/// Checks if a '-' is valid at the given position for the given ISBN type
fn is_dash_valid(position: &usize, isbn_type: &IsbnType) -> bool {
return isbn_type == &IsbnType::Isbn13 &&
Copy link
Member

Choose a reason for hiding this comment

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

optionally, you may omit the return here if you also omit the trailing semicolon. Up to you whether to do that.

coefficient -= 1;
}

return checksum % 11 == 0;
Copy link
Member

Choose a reason for hiding this comment

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

optionally, you may omit the return here if you also omit the trailing semicolon. Up to you whether to do that.

@coriolinus
Copy link
Member

Going to delay merge until @ktomsic gives a definite yes/no to the requests from @petertseng, primarily #378 (review).

@ktomsic
Copy link
Contributor Author

ktomsic commented Nov 4, 2017

Sorry. Just been busy the past couple of days. Thanks for the suggestions, @petertseng. I've updated everything accordingly.

@coriolinus coriolinus merged commit 7a4b0e2 into exercism:master Nov 4, 2017
@coriolinus
Copy link
Member

Thanks for this contribution, @ktomsic!

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.

3 participants