Home | History | Annotate | Download | only in base

Lines Matching defs:packet

19 #include "packet.h"
25 // Test making a packet from another packet. The new packet should have the
26 // same payload bounds as the old packet.
28 // Create a packet with payload bounds
29 auto packet = TestPacket::Make(
32 // Create packet from bounded packet
33 auto new_packet = TestPacket::Make(packet);
35 // Check to see if the new packet is bounded by the payload of the old packet
44 auto packet = TestPacket::Make(test_avctp_data);
45 ASSERT_EQ(packet->size(), test_avctp_data.size());
47 packet = TestPacket::Make(test_avctp_data, test_avctp_data_payload_offset,
49 ASSERT_EQ(packet->size(), test_avrcp_data.size());
54 auto packet = TestPacket::Make(test_l2cap_data);
56 ASSERT_EQ(test_l2cap_data[i], (*packet)[i]);
59 packet = TestPacket::Make(test_avctp_data, test_avctp_data_payload_offset,
62 ASSERT_EQ(test_avrcp_data[i], (*packet)[i]);
68 auto packet =
70 ASSERT_DEATH((*packet)[test_l2cap_data.size()], "");
75 auto packet = TestPacket::Make(
79 auto it = packet->begin();
80 for (size_t i = 0; i < packet->size(); i++) {
81 ASSERT_EQ((*packet)[i], *it++);
85 ASSERT_EQ(it, packet->end());
95 // Test specializing a packet to another packet type
97 auto packet = TestPacket::Make(test_l2cap_data);
100 Packet::Specialize<ChildTestPacket>(packet);
102 // Test that the new packet is an instance of ChildTestPacket
106 ASSERT_EQ(&specialized_packet->GetData(), &packet->GetData());
109 // Test that when the packet goes out of scope, that the underlying memory is
112 auto packet = TestPacket::Make(test_l2cap_data);
113 std::weak_ptr<std::vector<uint8_t>> data_ptr(packet->GetDataPointer());
117 packet.reset();