-
Notifications
You must be signed in to change notification settings - Fork 65
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 intersect util method for StringSet #4
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
// Add testItems to testSet | ||
for _, item := range testItems { |
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.
use string set Add method
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.
I can do it but then tests will be different from previous ones.
} | ||
|
||
// Intersect the two stringSet | ||
intersection := testSet.Intersect(testSet1) |
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.
Use test table and add more unit tests such as
- No intersection result
- Empty sets
- both set are purely different.
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.
ok, done.
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.
Use table driven tests, rather than creating separate tests.
https://github.com/golang/go/wiki/TableDrivenTests
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.
cool stuff!
Thanks I understand what you meant now.
Tests unified in one according to TableDrivenTests.
I do not think we should add the func if there is no use case. |
That's fine. |
@axamon Update the commit message to be more meaningful. |
I added the intersect function for *StringSet types that is concurrency safe. |
Can you change commit name from "added intersect" to something "Add intersect util method for StringSet" As well as change commit message from "might be useful" -> relevant to the PR. |
@axamon Thank for the fixes, we do not have unit & integration test CI setup at open source yet. I will run the patch locally, if no errors then I will merge the PR. |
Intersect function for *StringSet types that is concurrent safe added.