Repository navigation
test(PythagoreanTriplet): Add version and test case. - #1561
Conversation
1. Add version file in .meta folder. 2. Add missing test cases a/c to canonical data. 3. Update source file logic to save triplet in order a<=b<=c. 4. Reformat test file (eclipse deafult formatting). Signed-off-by: Prince Rachit Sinha <prince.rachit@mayadata.io>
FridaTveit
left a comment
There was a problem hiding this comment.
Thanks for tackling this @princerachit! 😄
I've left a few comments, feel free to ask questions or comment if you disagree with anything 🙂
| assertEquals(expected, actual); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Each test apart from the first one should be ignored by adding @Ignore("Remove to run test") above the @Test line. See our policies doc for more information 🙂
e0a4ec8 to
ca2e025
Compare
Signed-off-by: princerachit <prince.rachit@mayadata.io>
ca2e025 to
fcfbc9a
Compare
Signed-off-by: princerachit <prince.rachit@mayadata.io>
|
@FridaTveit @sjwarner-bp Sorry for the delay, was involved in a lot of hacktoberfest meetups. I have addressed all the changes. |
FridaTveit
left a comment
There was a problem hiding this comment.
This is looking good, thanks for tackling this @princerachit! 🙂 I've left a few comments, feel free to ask questions or disagree with me 🙂
| @@ -20,6 +20,156 @@ public void shouldCalculateSum() { | |||
| assertEquals(expected, actual); | |||
There was a problem hiding this comment.
This test doesn't appear to be in the canonical data? 🙂
| } | ||
| } | ||
|
|
||
| @Ignore("Remove to run test") |
There was a problem hiding this comment.
This test and all the ones below it don't appear to be in the canonical data? In which case they should be removed 🙂
| List<PythagoreanTriplet> actual | ||
| = PythagoreanTriplet | ||
| .makeTripletsList() | ||
| .withFactorsLessThanOrEqualTo(12) |
There was a problem hiding this comment.
The statement above doesn't appear to be a constraint in the canonical data?
There was a problem hiding this comment.
Is this restriction needed @princerachit? 🙂 The same holds for many of the other tests. The restriction withFactorsLessThanOrEqualTo isn't mentioned in the canonical data so I don't think it's needed?
It's only a minor thing though so if you would prefer for me to open a separate issue to fix it then I'm happy to do that. Just let me know what you would prefer 🙂
|
|
||
| assertEquals(expected.size(), actual.size()); | ||
| for (int i = 0; i < expected.size(); ++i) { | ||
| assertEquals(expected.get(i), actual.get(i)); |
There was a problem hiding this comment.
Is there a reason why you can't just compare the list here instead of iterating over it and comparing individual elements? 🙂
|
|
||
| List<PythagoreanTriplet> expected | ||
| = Arrays.asList( | ||
| new PythagoreanTriplet(3, 4, 5)); |
There was a problem hiding this comment.
This statement looks short enough to all be on one line 🙂 And you can use Collections.singletonList since the list just has one element 🙂
| .thatSumTo(1001) | ||
| .build(); | ||
|
|
||
| List<PythagoreanTriplet> expected = Arrays.asList(); |
There was a problem hiding this comment.
You can use Collections.emptyList here 🙂
|
will incorporate all changes and push the commits this weekend. Thanks |
Signed-off-by: princerachit <prince.rachit@mayadata.io>
FridaTveit
left a comment
There was a problem hiding this comment.
This is looking very close to being ready to merge @princerachit! Thanks for being patient and making the changes 🙂
I've left one comment and there's one comment from last time that I think you haven't addressed. There are also now some conflicts with the main branch so you'll have to rebase on the master branch (or merge the master branch into this one) before this can be merged. Let us know if you have any problems with that! 🙂
|
|
||
| public class PythagoreanTripletTest { | ||
|
|
||
| @Ignore("Remove to run test") |
There was a problem hiding this comment.
The first test shouldn't have an Ignore statement above it. All tests apart from the first one should have an Ignore statement. That way the users can deal with making one test pass at a time 🙂
| List<PythagoreanTriplet> actual | ||
| = PythagoreanTriplet | ||
| .makeTripletsList() | ||
| .withFactorsLessThanOrEqualTo(12) |
There was a problem hiding this comment.
Is this restriction needed @princerachit? 🙂 The same holds for many of the other tests. The restriction withFactorsLessThanOrEqualTo isn't mentioned in the canonical data so I don't think it's needed?
It's only a minor thing though so if you would prefer for me to open a separate issue to fix it then I'm happy to do that. Just let me know what you would prefer 🙂
|
Will incorporate the changes soon! |
|
Great, thanks @princerachit! 🙂 |
|
@princerachit how are you getting on with this? I think the only thing that needs to be changed is that the |
Signed-off-by: princerachit <prince.rachit@mayadata.io>
|
@FridaTveit can you help in resolving conflicts please? |
|
@princerachit The only change that has happened since you opened this PR is that we've added a linter. So I think you should:
Does that make sense? 🙂 |
|
@FridaTveit done |
FridaTveit
left a comment
There was a problem hiding this comment.
Looks great! Thanks @princerachit! 😄
Reformat test file (eclipse deafult formatting).Signed-off-by: Prince Rachit Sinha prince.rachit@mayadata.io
Reviewer Resources:
Track Policies