tests cleanup
This commit is contained in:
parent
16f3c66562
commit
4fa70b4ff2
|
@ -327,19 +327,18 @@ TEST(OSC, loopback)
|
||||||
message2->iStream(stream2);
|
message2->iStream(stream2);
|
||||||
|
|
||||||
std::vector<std::string> hits;
|
std::vector<std::string> hits;
|
||||||
auto echo = [](std::shared_ptr<OSC::Message> msg, const uint8_t *orig) {
|
auto echo = [&hits](std::shared_ptr<OSC::Message> msg, const uint8_t *orig) {
|
||||||
|
hits.push_back(msg->address_pattern);
|
||||||
auto buffer = std::vector<uint8_t>(msg->streamSize());
|
auto buffer = std::vector<uint8_t>(msg->streamSize());
|
||||||
auto stream = std::make_shared<bufferstream>(buffer.data(), buffer.size());
|
auto stream = std::make_shared<bufferstream>(buffer.data(), buffer.size());
|
||||||
msg->oStream(stream);
|
msg->oStream(stream);
|
||||||
EXPECT_FALSE(stream->fail()) << "message stream failed";
|
EXPECT_FALSE(stream->fail()) << "message stream failed";
|
||||||
EXPECT_EQ(memcmp(buffer.data(), orig, buffer.size()), 0) << "message output mismatch";
|
EXPECT_EQ(memcmp(buffer.data(), orig, buffer.size()), 0) << "message output mismatch";
|
||||||
};
|
};
|
||||||
auto echo1 = [&echo, &hits](std::shared_ptr<OSC::Message> msg) {
|
auto echo1 = [&echo](std::shared_ptr<OSC::Message> msg) {
|
||||||
hits.push_back(msg->address_pattern);
|
|
||||||
echo(msg, message1_data);
|
echo(msg, message1_data);
|
||||||
};
|
};
|
||||||
auto echo2 = [&echo, &hits](std::shared_ptr<OSC::Message> msg) {
|
auto echo2 = [&echo](std::shared_ptr<OSC::Message> msg) {
|
||||||
hits.push_back(msg->address_pattern);
|
|
||||||
echo(msg, message2_data);
|
echo(msg, message2_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -361,7 +360,7 @@ TEST(OSC, loopback)
|
||||||
EXPECT_STREQ(hits.front().c_str(), "/oscillator/4/frequency") << "method address mismatch";
|
EXPECT_STREQ(hits.front().c_str(), "/oscillator/4/frequency") << "method address mismatch";
|
||||||
|
|
||||||
hits.clear();
|
hits.clear();
|
||||||
tx.send(std::shared_ptr<OSC::Message>(message2));
|
tx.send(message2);
|
||||||
ASSERT_EQ(hits.size(), 1) << "method hit mismatch";
|
ASSERT_EQ(hits.size(), 1) << "method hit mismatch";
|
||||||
EXPECT_STREQ(hits.front().c_str(), "/foo") << "method address mismatch";
|
EXPECT_STREQ(hits.front().c_str(), "/foo") << "method address mismatch";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue