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

Add more stubs (pythagorean-triplet, perfect-numbers) #370

Merged
merged 2 commits into from
Nov 8, 2017
Merged

Add more stubs (pythagorean-triplet, perfect-numbers) #370

merged 2 commits into from
Nov 8, 2017

Conversation

elbaro
Copy link
Contributor

@elbaro elbaro commented Oct 25, 2017

No description provided.

@elbaro
Copy link
Contributor Author

elbaro commented Oct 25, 2017

Oops, there is example.rs but fetch rust doesn't download the file.
#269 is related

@petertseng
Copy link
Member

Thanks.

there is example.rs but fetch rust doesn't download the file.

Correct, it does not.

Update lib.rs

I'd like to ask the commit message to be amended because "Update" is too vague. A function stub was added, so the commit message should say that.

@elbaro elbaro changed the title pythagorean-triplet lib.rs Add more stubs Oct 26, 2017
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 these stubs!

@@ -0,0 +1,7 @@
pub enum Classification {

Copy link
Member

Choose a reason for hiding this comment

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

I request that the three possible variants of Classification be included in the stub, since there is no point in keeping them from the student; the test expects them and the description lists them already.

The other reason is that the stub will not compile without it.

The precedent for this request is in https://github.com/exercism/rust/blob/master/exercises/forth/src/lib.rs#L7-L12 and https://github.com/exercism/rust/blob/master/exercises/robot-simulator/src/lib.rs#L4-L10.

}

pub fn classify(num: u64) -> Result<Classification, &'static str> {

Copy link
Member

Choose a reason for hiding this comment

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

there should be unimplemented!() here, otherwise the stub will not compile because the compiler thinks () is being returned

The reason for this request is so that cargo test -- --no-run can be run on this stub, for the purpose of automatically ensuring that the signature provided in the stub is correct (I am unable to manually ensure this, because of time).

@@ -0,0 +1,4 @@
pub fn find() -> Option<u32> {

Copy link
Member

Choose a reason for hiding this comment

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

there should be unimplemented!() here, otherwise the stub will not compile because the compiler thinks () is being returned

The reason for this request is so that cargo test -- --no-run can be run on this stub, for the purpose of automatically ensuring that the signature provided in the stub is correct (I am unable to manually ensure this, because of time).

@petertseng
Copy link
Member

Very good, thank you! Will you do us the favour of combining the commits such that the final state is two commits:

  • one commit that adds the perfect-numbers stub in its final form
  • one commit that adds the pythagorean-triplet stub in its final form

We wouldn't want this repo to have intermediate commits where there are stubs that are not runnable

(Ask if you need advice on how to achieve it. One might think of various ways like an interactive rebase or reset, add, commit, add, commit)

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.

indeed, this has been done. We are ready to merge.

@petertseng petertseng merged commit 5b12ad7 into exercism:master Nov 8, 2017
@petertseng petertseng changed the title Add more stubs Add more stubs (pythagorean-triplet, perfect-numbers) Nov 8, 2017
@petertseng
Copy link
Member

Thank you for contributing these stubs!

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.

2 participants