-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
test: Add test for vertices and edge count in pgraph #682
base: master
Are you sure you want to change the base?
Conversation
725da49
to
5c50033
Compare
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.
Thanks for the patch! As I hear that you're learning golang, I decided to nit a few things to help you practice your rebasing. Let me know if it makes sense or if you have any questions.
Thanks!
|
||
// populate edges | ||
var edges [5]Edge | ||
for x := 0; x < len(edges); x++ { |
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.
You can re-use i
as a counter variable here and below...
// populate edges | ||
var edges [5]Edge | ||
for x := 0; x < len(edges); x++ { | ||
var name string = "e" + strconv.Itoa(x+1) |
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.
name := ...
|
||
// add edges to the vertices | ||
for a := 0; a < len(vertices); a++ { | ||
var b int = a + 1 |
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.
b := a + 1
// add edges to the vertices | ||
for a := 0; a < len(vertices); a++ { | ||
var b int = a + 1 | ||
if a <= len(vertices)-2 { |
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.
Subtle: -2's don't usually appear in code as much as -1's. Since we're a zero-based language, it's expected to see a -1 here and there... But you're using the -2 off of the first of the two elements... So it raises an eyebrow... So probably best to use -1 and compare it to b instead.
2319f4f
to
04f5ba6
Compare
fe2313c
to
271a94e
Compare
Added a test for vertices and edge count in pgraph.