35 #include "gtest/gtest.h" 37 #include <boost/shared_ptr.hpp> 39 TEST(DataTest, Constructor)
53 TEST(DataTest, GetNumPackets)
80 EXPECT_NE(v_1_packet_ptr, boost::shared_ptr<create::Packet>())
81 <<
"ID_OVERCURRENTS packet not found for protocol V_1";
82 EXPECT_EQ(static_cast<int>(v_1_packet_ptr->nbytes), 1);
83 EXPECT_EQ(v_1_packet_ptr->info, std::string(
"overcurrents"));
88 EXPECT_NE(v_2_packet_ptr, boost::shared_ptr<create::Packet>())
89 <<
"ID_DISTANCE packet not found for protocol V_2";
90 EXPECT_EQ(static_cast<int>(v_2_packet_ptr->nbytes), 2);
91 EXPECT_EQ(v_2_packet_ptr->info, std::string(
"distance"));
96 EXPECT_NE(v_3_packet_ptr, boost::shared_ptr<create::Packet>())
97 <<
"ID_LIGHT_FRONT_RIGHT packet not found for protocol V_3";
98 EXPECT_EQ(static_cast<int>(v_3_packet_ptr->nbytes), 2);
99 EXPECT_EQ(v_3_packet_ptr->info, std::string(
"light_bumper_front_right"));
102 boost::shared_ptr<create::Packet> not_a_packet_ptr = data_v_3.
getPacket(60);
103 EXPECT_EQ(not_a_packet_ptr, boost::shared_ptr<create::Packet>());
109 const std::vector<uint8_t> packet_ids = data_v_3.
getPacketIDs();
111 ASSERT_EQ(static_cast<int>(packet_ids.size()), 29);
115 for (std::size_t i = 0; (i < packet_ids.size()) && !found; i++)
122 EXPECT_TRUE(found) <<
"ID_LEFT_ENC packet ID not returned for protocol V_3";
125 TEST(DataTest, GetTotalDataBytes)
141 TEST(DataTest, IsValidPacketID)
145 <<
"ID_DIRT_DETECT_RIGHT packet not found for protocol V_1";
147 <<
"ID_OI_MODE packet should not exist for protocol V_1";
152 <<
"ID_ANGLE packet not found for protocol V_2";
154 <<
"ID_LIGHT packet should not exist for protocol V_2";
159 <<
"ID_STATIS packet not found for protocol V_3";
161 <<
"ID_DISTANCE packet should not exist for protocol V_3";
uint8_t getNumPackets() const
bool isValidPacketID(const uint8_t id) const
std::vector< uint8_t > getPacketIDs()
uint32_t getTotalDataBytes() const
boost::shared_ptr< Packet > getPacket(const uint8_t id)
TEST(DataTest, Constructor)