1 #include <marnav/seatalk/message_38.hpp>
2 #include <gtest/gtest.h>
7 using namespace marnav::seatalk
;
9 class Test_seatalk_message_38
: public ::testing::Test
13 TEST_F(Test_seatalk_message_38
, construction
)
18 TEST_F(Test_seatalk_message_38
, parse_invalid_data_size
)
20 EXPECT_ANY_THROW(message_38::parse({3, 0x00}));
21 EXPECT_ANY_THROW(message_38::parse({5, 0x00}));
24 TEST_F(Test_seatalk_message_38
, parse_invalid_length
)
26 EXPECT_ANY_THROW(message_38::parse({0x38, 0x00, 0x00, 0x01}));
27 EXPECT_ANY_THROW(message_38::parse({0x38, 0x02, 0x00, 0x01}));
30 TEST_F(Test_seatalk_message_38
, parse
)
36 std::vector
<test_case
> cases
{
37 {{0x38, 0x01, 0x00, 0x00}},
40 for (auto const & t
: cases
) {
41 auto generic_message
= message_38::parse(t
.data
);
42 EXPECT_TRUE(generic_message
!= nullptr);
45 auto m
= message_cast
<message_38
>(generic_message
);
46 EXPECT_TRUE(m
!= nullptr);
52 TEST_F(Test_seatalk_message_38
, write_default
)
54 const raw expected
{0x38, 0x01, 0x00, 0x00};
57 EXPECT_EQ(expected
, m
.get_data());