forked from sccn/liblsl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiscovery.cpp
More file actions
26 lines (21 loc) · 877 Bytes
/
discovery.cpp
File metadata and controls
26 lines (21 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "catch.hpp"
#include <lsl_cpp.h>
#include <thread>
namespace {
TEST_CASE("resolve multiple streams", "[resolver][basic]") {
lsl::continuous_resolver resolver("type", "Resolve", 50.);
std::vector<lsl::stream_outlet> outlets;
const int n = 3;
for (int i = 0; i < n; i++)
outlets.emplace_back(lsl::stream_info("resolvetest_" + std::to_string(i), "Resolve"));
auto found_stream_info = lsl::resolve_stream("type", "Resolve", n, 2.0);
REQUIRE(found_stream_info.size() == n);
// Allow the resolver a bit more time in case the first resolve wave was too fast
std::this_thread::sleep_for(std::chrono::seconds(1));
REQUIRE(resolver.results().size() == n);
}
TEST_CASE("resolve from streaminfo", "[resolver][streaminfo][basic]") {
lsl::stream_outlet outlet(lsl::stream_info("resolvetest", "from_streaminfo"));
lsl::stream_inlet(outlet.info());
}
} // namespace