-
Notifications
You must be signed in to change notification settings - Fork 170
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
#802 created iterator of floats and ints #832
Conversation
Job #832 is now in scope, role is |
This pull request #832 is assigned to @proshin-roman/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @llorllale/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk I found a few issues - please, check if they should/can be fixed.
/** | ||
* The list of items to iterate. | ||
*/ | ||
private final float[] list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk As this field is not a list anyway, wouldn't it better to rename it to items
?
/** | ||
* The list of items to iterate. | ||
*/ | ||
private final int[] list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk same here: rename it to items
?
@Test | ||
public void emptyIteratorDoesNotHaveNext() { | ||
MatcherAssert.assertThat( | ||
"Can't create empty iterator", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk The failure message looks strange - failing of the assertions means that empty iterator has the next item which is wrong. Could you adjust the message, please?
MatcherAssert.assertThat( | ||
"Can't create empty iterator", | ||
new IteratorOfFloats().hasNext(), | ||
CoreMatchers.equalTo(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk let's please use new IsEqual(true)
instead of calling a static method?
@Test | ||
public void nonEmptyIteratorDoesNotHaveNext() { | ||
MatcherAssert.assertThat( | ||
"Can't create non empty iterator", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk here again: the failure message is not correct - it should explain the cause of assertion failing: an iterator with fetched items still has the next item which is wrong. Please, fix the message.
MatcherAssert.assertThat( | ||
"Can't create non empty iterator", | ||
this.iteratorWithFetchedElements().hasNext(), | ||
CoreMatchers.equalTo(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk And here too: please, use IsEqual
* @since 0.32 | ||
* @checkstyle JavadocMethodCheck (500 lines) | ||
*/ | ||
public final class IteratorOfIntsTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk all comments written for IteratorOfFloatsTest
can be applied for this class as well.
return iterable; | ||
}); | ||
super(() -> () | ||
-> new UncheckedScalar<>(() -> new IteratorOfInts(values)).value() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk I might be wrong here (please, correct me if it's so), but using of UncheckedScalar
looks redundant here, as the super
ctor already wraps the argument into UncheckedScalar
:
this.iterable = new UncheckedScalar<>(scalar); |
Could you check please if that's correct and UncheckedScalar can be ommitted here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@proshin-roman unchecked scalar is for Iterator
interface (there are 3 lambdas here) so I need to wrap it at the bottom, wrapping in IterableEnvelope doesn't help here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk why didn't you just write () -> () -> new IteratorOfInts(values)
? I don't get what you wrote provides. The constructor of IteratorOfInts
does not throw any exception...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krzyk or () -> new IterableOf<>(new IteratorOfInts(values))
if you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victornoel I didn't know I could (regarding the first of your comments - it wasn't possible, I didn't tried the second one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #832 +/- ##
============================================
+ Coverage 84.51% 84.56% +0.04%
- Complexity 1368 1376 +8
============================================
Files 249 251 +2
Lines 3695 3705 +10
Branches 215 213 -2
============================================
+ Hits 3123 3133 +10
Misses 524 524
Partials 48 48
Continue to review full report at Codecov.
|
@proshin-roman I've updated the code, please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@llorllale good to merge
@rultor merge |
@llorllale OK, I'll try to merge now. You can check the progress of the merge here |
@llorllale Done! FYI, the full log is here (took me 10min) |
@elenavolokhova/z please review this job completed by @proshin-roman/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed |
The job #832 is now out of scope |
@0crat quality good |
Order was finished, quality is "good": +20 point(s) just awarded to @proshin-roman/z |
Quality review completed: +8 point(s) just awarded to @elenavolokhova/z |
#802
IteratorOfFloats
andIteratorOfInts
and updated the appropriate Iterables