1
0
Fork 0

tests cleanup

This commit is contained in:
Kevin Matz 2023-05-16 08:43:43 -04:00
parent 16f3c66562
commit 4fa70b4ff2
1 changed files with 5 additions and 6 deletions

View File

@ -327,19 +327,18 @@ TEST(OSC, loopback)
message2->iStream(stream2);
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 stream = std::make_shared<bufferstream>(buffer.data(), buffer.size());
msg->oStream(stream);
EXPECT_FALSE(stream->fail()) << "message stream failed";
EXPECT_EQ(memcmp(buffer.data(), orig, buffer.size()), 0) << "message output mismatch";
};
auto echo1 = [&echo, &hits](std::shared_ptr<OSC::Message> msg) {
hits.push_back(msg->address_pattern);
auto echo1 = [&echo](std::shared_ptr<OSC::Message> msg) {
echo(msg, message1_data);
};
auto echo2 = [&echo, &hits](std::shared_ptr<OSC::Message> msg) {
hits.push_back(msg->address_pattern);
auto echo2 = [&echo](std::shared_ptr<OSC::Message> msg) {
echo(msg, message2_data);
};
@ -361,7 +360,7 @@ TEST(OSC, loopback)
EXPECT_STREQ(hits.front().c_str(), "/oscillator/4/frequency") << "method address mismatch";
hits.clear();
tx.send(std::shared_ptr<OSC::Message>(message2));
tx.send(message2);
ASSERT_EQ(hits.size(), 1) << "method hit mismatch";
EXPECT_STREQ(hits.front().c_str(), "/foo") << "method address mismatch";
}