test(tools): add tests for the tools library

- RateLimiter: lower bound of the duration at 200 Hz; rate 0 does not
  sleep
- InstanceLimiter: throws above the limit, counts down on destruction
- Semaphore and SharedSemaphore: counts, blocking Wait(), shared count
- ToString(), StrStartsWith(), StrEndsWith(), ToStrVector()
- Uuid() and UuidHash() are unique
- execute(): output with prefix, stderr, exit code, stdin input,
  signal, timeout
- Skip Tools.NetworkDefaultIP on a machine without a default route

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-03 14:53:55 +00:00
committed by Dennis Klein
parent cc3297b2fd
commit 788ca57859
3 changed files with 195 additions and 1 deletions

View File

@@ -16,7 +16,9 @@ namespace
TEST(Tools, NetworkDefaultIP)
{
auto const interface = fair::mq::tools::getDefaultRouteNetworkInterface();
EXPECT_NE(interface, "");
if (interface.empty()) {
GTEST_SKIP() << "no default route on this machine";
}
auto const interfaceIP = fair::mq::tools::getInterfaceIP(interface);
EXPECT_NE(interfaceIP, "");
}