Project import generated by Copybara.

GitOrigin-RevId: 27c70b5fe62ab71189d358ca122ee4b19c817a8f
This commit is contained in:
MediaPipe Team
2021-07-27 19:36:32 -04:00
committed by chuoling
parent 374f5e2e7e
commit 50c92c6623
158 changed files with 4704 additions and 621 deletions
+16
View File
@@ -21,6 +21,7 @@
#include <vector>
#include "absl/strings/str_cat.h"
#include "mediapipe/framework/deps/message_matchers.h"
#include "mediapipe/framework/packet_test.pb.h"
#include "mediapipe/framework/port/core_proto_inc.h"
#include "mediapipe/framework/port/gmock.h"
@@ -214,6 +215,21 @@ TEST(PacketTest, ValidateAsProtoMessageLite) {
EXPECT_EQ(status.code(), absl::StatusCode::kInvalidArgument);
}
TEST(PacketTest, GetVectorOfProtos) {
std::vector<mediapipe::PacketTestProto> protos(2);
protos[0].add_x(123);
protos[1].add_x(456);
// Normally we'd move here, but we copy to use the protos for comparison.
const Packet packet =
MakePacket<std::vector<mediapipe::PacketTestProto>>(protos);
auto maybe_proto_ptrs = packet.GetVectorOfProtoMessageLitePtrs();
EXPECT_THAT(maybe_proto_ptrs,
IsOkAndHolds(testing::Pointwise(EqualsProto(), protos)));
const Packet wrong = MakePacket<int>(1);
EXPECT_THAT(wrong.GetVectorOfProtoMessageLitePtrs(), testing::Not(IsOk()));
}
TEST(PacketTest, SyncedPacket) {
Packet synced_packet = AdoptAsSyncedPacket(new int(100));
Packet value_packet =