1 #include <gtest/gtest.h>
2 #include <marnav/seatalk/message_26.hpp>
7 using namespace marnav
;
9 class Test_seatalk_message_26
: public ::testing::Test
13 TEST_F(Test_seatalk_message_26
, construction
)
15 seatalk::message_26 m
;
18 TEST_F(Test_seatalk_message_26
, parse_invalid_data_size
)
20 EXPECT_ANY_THROW(seatalk::message_26::parse({6, 0x00}));
21 EXPECT_ANY_THROW(seatalk::message_26::parse({8, 0x00}));
24 TEST_F(Test_seatalk_message_26
, parse_invalid_length
)
26 EXPECT_ANY_THROW(seatalk::message_26::parse({0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}));
27 EXPECT_ANY_THROW(seatalk::message_26::parse({0x26, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}));
30 TEST_F(Test_seatalk_message_26
, parse
)
36 std::vector
<test_case
> cases
{
37 {{0x26, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}},
40 for (auto const & t
: cases
) {
41 auto generic_message
= seatalk::message_26::parse(t
.data
);
42 EXPECT_TRUE(generic_message
!= nullptr);
45 auto m
= seatalk::message_cast
<seatalk::message_26
>(generic_message
);
46 EXPECT_TRUE(m
!= nullptr);
49 EXPECT_EQ(seatalk::message_id::speed_through_water_2
, m
->type());