Conversation
|
Changelog? |
servus/test/servus.h
Outdated
| browse(browseTime); | ||
| if (result != servus::Servus::Result::PENDING) | ||
| endBrowsing(); | ||
| return getInstances(); |
There was a problem hiding this comment.
Hmm, I've been struggling to understand this function.
It is not immediately clear for the reader why Result has both a bool operator and an int comparison operator, and that the bool is equivalent to result == servus::Servus::Result::SUCCESS. Anyway, how about the following form which avoids the multiple return and negative checks?
const auto result = beginBrowsing(addr);
const bool canBrowse = result == servus::Servus::Result::SUCCESS;
const bool browsePending = result == servus::Servus::Result::PENDING;
if (canBrowse || browsePending)
{
browse(browseTime);
if (!browsePending)
endBrowsing();
}
return getInstances();
There was a problem hiding this comment.
yes, +1 for eliminating the duplication, this felt like it should be a function of the parent class.
|
Re Changelog: Is this a user feature, aka should we document it? |
|
I would also add a changelog entry, it doesn't cost anything and this is a new feature if you want to write unit tests like in ZeroEQ ;-) |
|
Definitely a user feature, as the user is a developer who uses Servus as library and he/she wants to write unit tests using servus. |
|
@eile the changelog is still missing... ;-) |
No description provided.