1 #include <gtest/gtest.h>
2 #include <marnav/seatalk/message_36.hpp>
7 using namespace marnav::seatalk
;
9 class Test_seatalk_message_36
: public ::testing::Test
13 TEST_F(Test_seatalk_message_36
, construction
)
18 TEST_F(Test_seatalk_message_36
, parse_invalid_data_size
)
20 EXPECT_ANY_THROW(message_36::parse({1, 0x00}));
21 EXPECT_ANY_THROW(message_36::parse({2, 0x00}));
24 TEST_F(Test_seatalk_message_36
, parse_invalid_length
)
26 EXPECT_ANY_THROW(message_36::parse({0x36, 0x01, 0x01}));
27 EXPECT_ANY_THROW(message_36::parse({0x36, 0x02, 0x01}));
30 TEST_F(Test_seatalk_message_36
, parse
)
36 std::vector
<test_case
> cases
{
40 for (auto const & t
: cases
) {
41 auto generic_message
= message_36::parse(t
.data
);
42 EXPECT_TRUE(generic_message
!= nullptr);
45 auto m
= message_cast
<message_36
>(generic_message
);
46 EXPECT_TRUE(m
!= nullptr);
49 EXPECT_EQ(message_id::cancel_mob_condition
, m
->type());
53 TEST_F(Test_seatalk_message_36
, write_default
)
55 const raw expected
{0x36, 0x00, 0x01};
58 EXPECT_EQ(expected
, m
.get_data());